Conversation
WalkthroughConsolidates many per-component Changes
Sequence Diagram(s)mermaid Dev->>Vite: run build (TINY_MODE / TINY_THEME) Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly Related PRs
Suggested Reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Fix all issues with AI agents
In `@packages/search-box/scripts/post-build.js`:
- Around line 149-154: The dependencies block in the Vue 3 Normal build still
lists granular packages (e.g., '@opentiny/vue-button', '@opentiny/vue-common',
'@opentiny/vue-icon', '@opentiny/vue-theme') while other variants consolidate to
the single package '@opentiny/vue'; update the dependencies object in
post-build.js for the Vue 3 Normal variant to replace the granular entries with
a single '@opentiny/vue' entry (matching the pattern used by Vue 2 Normal, Vue 2
Saas, and Vue 3 Saas) so all variants use the consolidated package.
In `@packages/search-box/src/components/first-level-panel.vue`:
- Line 178: The emits array in the FirstLevelPanel component incorrectly
declares 'click' even though the component never emits it; remove 'click' from
the emits definition (leave only 'events') in the component options (the emits:
[...] declaration) and scan for any references to emitting 'click' in methods or
template to confirm nothing else is expected to change.
In `@packages/search-box/vite.config.vue2-saas.ts`:
- Around line 145-147: The non-suffixed alias 'vue-template-compiler' appears
unused and redundant because 'vue-template-compiler$' already exists; remove the
plain 'vue-template-compiler' alias entry from the alias list and keep the
suffixed alias intact, leaving '@opentiny/vue-search-box-theme' -> resolve(...,
'theme-saas/index.less') unchanged; after removal, run the dev/build and
search-box tests to confirm nothing breaks and restore the alias only if an
import/require elsewhere actually needs the non-suffixed name.
In `@packages/search-box/vite.config.vue3-saas.ts`:
- Around line 50-55: The treeshake configuration (treeshake.moduleSideEffects)
is too aggressive and can remove CSS imports; update the treeshake setting in
vite.config (the treeshake block using moduleSideEffects,
propertyReadSideEffects, tryCatchDeoptimization) so CSS/LESS and theme files are
preserved — either implement moduleSideEffects as a predicate that returns true
for CSS/LESS and theme paths (so those imports are treated as having side
effects) or add a plugin hook that marks those files as having side effects
before Rollup runs; ensure the logic references file extensions/paths for
'*.css', '*.less', './theme/', './theme-saas/' so only non-CSS modules remain
aggressively tree-shaken.
In `@packages/vue2-test/vite.config.js`:
- Around line 73-74: The alias resolution is inconsistent: change the resolve
call for "@opentiny/vue-common" to use the same __dirname-based path as
"@opentiny/vue". Update the resolve invocation that currently references
'../search-box/node_modules/@opentiny/vue-common' to resolve(__dirname,
'../search-box/node_modules/@opentiny/vue-common') so both aliases use __dirname
(look for the alias entries for "@opentiny/vue" and "@opentiny/vue-common" in
vite.config.js).
🧹 Nitpick comments (3)
packages/search-box/src/components/second-level-panel.vue (1)
361-361: Declared'click'emit appears unused.Same observation as
first-level-panel.vue: the'click'event is declared but noemit('click', ...)call exists in the component. Verify this is intentional or remove the unused declaration.packages/vue2-test/vite.config.js (1)
89-98: Redundant conditional paths structure.Both branches of the ternary produce the same path structure since both use
theme${isSaas ? '-saas' : ''}. Consider simplifying:Suggested simplification
- paths: isSaas - ? [ - // 只包含 theme-saas 目录,不包含 theme 目录 - resolve(__dirname, `../search-box/theme${isSaas ? '-saas' : ''}`), - ] - : [ - // 普通模式:包含 theme 目录 - resolve(__dirname, `../search-box/theme${isSaas ? '-saas' : ''}`), - ], + paths: [ + resolve(__dirname, `../search-box/theme${isSaas ? '-saas' : ''}`), + ],packages/vue3-test/vite.config.js (1)
29-39: Simplify redundant conditional in Less paths configuration.Both branches of the outer ternary contain the same template string expression, which makes the conditional structure unnecessary. The inner
${isSaas ? '-saas' : ''}already handles the mode differentiation correctly.♻️ Suggested simplification
less: { javascriptEnabled: true, - // Saas 模式下,限制路径解析,避免自动引入 theme/vars.less - paths: isSaas - ? [ - // 只包含 theme-saas 目录,不包含 theme 目录 - resolve(`../../packages/search-box/theme${isSaas ? '-saas' : ''}`), - ] - : [ - // 普通模式:包含 theme 目录 - resolve(`../../packages/search-box/theme${isSaas ? '-saas' : ''}`), - ], + // 根据模式选择对应的 theme 目录 + paths: [ + resolve(`../../packages/search-box/theme${isSaas ? '-saas' : ''}`), + ], },
| } | ||
| }, | ||
| emits: ['events'], | ||
| emits: ['events', 'click'], |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for emit('click') patterns in search-box package
rg -n "emit\(['\"]click['\"]" packages/search-box/src/Repository: opentiny/tiny-search-box
Length of output: 50
🏁 Script executed:
cat -n packages/search-box/src/components/first-level-panel.vueRepository: opentiny/tiny-search-box
Length of output: 6950
🏁 Script executed:
rg -n "first-level-panel|FirstLevelPanel" packages/search-box/src/ --type vue --type ts --type jsRepository: opentiny/tiny-search-box
Length of output: 95
🏁 Script executed:
rg -n "first-level-panel|FirstLevelPanel" packages/search-box/src/Repository: opentiny/tiny-search-box
Length of output: 516
🏁 Script executed:
sed -n '121,130p' packages/search-box/src/pc.vueRepository: opentiny/tiny-search-box
Length of output: 420
🏁 Script executed:
sed -n '115,135p' packages/search-box/src/pc.vueRepository: opentiny/tiny-search-box
Length of output: 724
🏁 Script executed:
sed -n '119,130p' packages/search-box/src/pc.vueRepository: opentiny/tiny-search-box
Length of output: 471
🏁 Script executed:
rg -n "@click" packages/search-box/src/pc.vue | head -20Repository: opentiny/tiny-search-box
Length of output: 811
Remove unused 'click' emit from the emits array.
The 'click' event is declared in line 178 but is never emitted anywhere in this component. All event handling goes through the 'events' emit. Remove 'click' from the emits array to avoid confusion and maintain clarity about which events this component actually broadcasts.
🤖 Prompt for AI Agents
In `@packages/search-box/src/components/first-level-panel.vue` at line 178, The
emits array in the FirstLevelPanel component incorrectly declares 'click' even
though the component never emits it; remove 'click' from the emits definition
(leave only 'events') in the component options (the emits: [...] declaration)
and scan for any references to emitting 'click' in methods or template to
confirm nothing else is expected to change.
| 'vue-template-compiler': resolve(__dirname, 'node_modules/vue-template-compiler'), | ||
| // 开发环境和打包环境都支持样式别名导入 | ||
| '@opentiny/vue-search-box-theme': resolve(__dirname, 'theme-saas/index.less') |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find imports that rely on the new aliases
echo "=== Searching for vue-template-compiler imports ==="
rg -n "\bvue-template-compiler\b" --type-list | head -20
rg -n "vue-template-compiler" -g '*.{ts,js,vue}' 2>/dev/null || true
echo ""
echo "=== Searching for `@opentiny/vue-search-box-theme` imports ==="
rg -n "@opentiny/vue-search-box-theme" -g '*.{ts,js,vue,md,mdx,less,css}' 2>/dev/null || trueRepository: opentiny/tiny-search-box
Length of output: 2544
Theme alias is confirmed in use; verify need for non-suffixed vue-template-compiler alias.
The @opentiny/vue-search-box-theme alias is actively imported across multiple files and correctly routes to theme-saas/index.less for SaaS builds. However, the non-suffixed vue-template-compiler alias shows no actual imports in application code—only a require() call in the config file itself. Since the suffixed version ('vue-template-compiler$') already exists in the same file, the non-suffixed version may be redundant and could be removed for clarity.
🤖 Prompt for AI Agents
In `@packages/search-box/vite.config.vue2-saas.ts` around lines 145 - 147, The
non-suffixed alias 'vue-template-compiler' appears unused and redundant because
'vue-template-compiler$' already exists; remove the plain
'vue-template-compiler' alias entry from the alias list and keep the suffixed
alias intact, leaving '@opentiny/vue-search-box-theme' -> resolve(...,
'theme-saas/index.less') unchanged; after removal, run the dev/build and
search-box tests to confirm nothing breaks and restore the alias only if an
import/require elsewhere actually needs the non-suffixed name.
| // 启用 tree-shaking,确保按需打包 | ||
| treeshake: { | ||
| moduleSideEffects: false, | ||
| propertyReadSideEffects: false, | ||
| tryCatchDeoptimization: false | ||
| }, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
fd -t f 'vite.config.vue3-saas.ts' packages/search-box --exec cat -n {} \;Repository: opentiny/tiny-search-box
Length of output: 192
🏁 Script executed:
fd -t f 'package.json' packages/search-box --exec cat {} \;Repository: opentiny/tiny-search-box
Length of output: 2361
🏁 Script executed:
# Check if there's a dist directory with built CSS
find packages/search-box -type f -name '*.css' | head -20Repository: opentiny/tiny-search-box
Length of output: 50
🌐 Web query:
Rollup moduleSideEffects false package.json sideEffects configuration behavior
💡 Result:
Short answer
- package.json "sideEffects": false signals that files in the package have no module-level side effects and therefore can be removed when unused. Bundlers use that hint for tree-shaking. [3]
- Rollup does not read package.json directly for every module; instead its treeshake.moduleSideEffects option (boolean | 'no-external' | list | function) controls how Rollup treats module side‑effects, and plugins/hooks (e.g., resolveId/load or the moduleInfo.moduleSideEffects flag returned by plugin hooks) can override per-module behavior. Setting treeshake.moduleSideEffects to false lets Rollup drop modules that are only imported for side effects. [1][2]
Behavior details and gotchas
- treeshake.moduleSideEffects: false — for non-external modules Rollup will not include any statements from a module unless at least one of its exports is used; for external modules it will try to suppress empty imports as well. Use 'no-external' or a function/list to treat externals differently. Example behavior and code snippets in Rollup docs. [1]
- Plugin hooks / module metadata — Rollup’s resolveId/load hooks (or returning moduleSideEffects via plugin module metadata) can mark a module as having side effects (true), no side effects (false), or "no-treeshake" to force inclusion. These override the global treeshake.moduleSideEffects behavior for that module. [2]
- Re-exports and side-effects scanning — If a module with sideEffects=false re-exports directly from another module (export {x} from './c'), Rollup may ignore the re-exporting module’s top-level side effects; indirect re-exports (import then export) can force scanning and retain side effects. See Rollup examples. [1]
- Common pitfalls (from other bundlers like webpack but applicable conceptually): marking sideEffects:false too broadly can drop CSS imports, polyfills, global registrations, or other global work that your package relies on. Mark specific files/patterns instead of a blanket false if you have such imports. [3]
What to do
- If your package truly has no top-level side effects across all files, "sideEffects": false is correct and enables maximal removal by bundlers. If some files (CSS, polyfills, setup) have side effects, list only the exception patterns (e.g. ["*.css","./polyfills.js"]) in package.json or configure Rollup’s treeshake.moduleSideEffects to return true for those modules. Use plugin hooks to force inclusion for special cases. [3][1][2]
Sources
- Rollup configuration — treeshake.moduleSideEffects and examples. [1]
- Rollup plugin development / module metadata (moduleSideEffects return values and overrides). [2]
- Webpack tree-shaking guide and explanation of package.json sideEffects pitfalls. [3]
Aggressive tree-shaking may drop CSS imports unintentionally.
Setting moduleSideEffects: false tells Rollup to drop any module whose exports are not used. CSS files imported purely for their side effects—such as import './style.css'—will be removed if this setting is applied globally without per-module overrides. While package.json correctly declares sideEffects: ['*.css', '*.less', './theme/**/*', './theme-saas/**/*'], this metadata is consumed by external bundlers, not Rollup during this package's own build. To ensure CSS survives tree-shaking here, either use a plugin hook to mark CSS files with moduleSideEffects: true, or scope moduleSideEffects: false only to non-CSS modules.
🤖 Prompt for AI Agents
In `@packages/search-box/vite.config.vue3-saas.ts` around lines 50 - 55, The
treeshake configuration (treeshake.moduleSideEffects) is too aggressive and can
remove CSS imports; update the treeshake setting in vite.config (the treeshake
block using moduleSideEffects, propertyReadSideEffects, tryCatchDeoptimization)
so CSS/LESS and theme files are preserved — either implement moduleSideEffects
as a predicate that returns true for CSS/LESS and theme paths (so those imports
are treated as having side effects) or add a plugin hook that marks those files
as having side effects before Rollup runs; ensure the logic references file
extensions/paths for '*.css', '*.less', './theme/', './theme-saas/' so only
non-CSS modules remain aggressively tree-shaken.
| "@opentiny/vue": resolve(__dirname, '../search-box/node_modules/@opentiny/vue'), | ||
| "@opentiny/vue-common": resolve('../search-box/node_modules/@opentiny/vue-common'), |
There was a problem hiding this comment.
Inconsistent path resolution: missing __dirname prefix.
Line 73 uses resolve(__dirname, '../search-box/node_modules/@opentiny/vue'), but line 74 uses resolve('../search-box/node_modules/@opentiny/vue-common') without __dirname. This can cause inconsistent resolution depending on the current working directory.
Proposed fix
- "@opentiny/vue-common": resolve('../search-box/node_modules/@opentiny/vue-common'),
+ "@opentiny/vue-common": resolve(__dirname, '../search-box/node_modules/@opentiny/vue-common'),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "@opentiny/vue": resolve(__dirname, '../search-box/node_modules/@opentiny/vue'), | |
| "@opentiny/vue-common": resolve('../search-box/node_modules/@opentiny/vue-common'), | |
| "@opentiny/vue": resolve(__dirname, '../search-box/node_modules/@opentiny/vue'), | |
| "@opentiny/vue-common": resolve(__dirname, '../search-box/node_modules/@opentiny/vue-common'), |
🤖 Prompt for AI Agents
In `@packages/vue2-test/vite.config.js` around lines 73 - 74, The alias resolution
is inconsistent: change the resolve call for "@opentiny/vue-common" to use the
same __dirname-based path as "@opentiny/vue". Update the resolve invocation that
currently references '../search-box/node_modules/@opentiny/vue-common' to
resolve(__dirname, '../search-box/node_modules/@opentiny/vue-common') so both
aliases use __dirname (look for the alias entries for "@opentiny/vue" and
"@opentiny/vue-common" in vite.config.js).
7538a02 to
649292b
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/search-box/scripts/post-build.js`:
- Around line 70-73: The package version for `@opentiny/vue-theme` is incorrectly
set to ^3.28.0 for the Vue2 builds; update the dependency strings for
'@opentiny/vue-theme' in both Vue2 blocks (the occurrences corresponding to the
earlier diff and the later block around lines 110-113) to '^2.28.0' so it
matches the other `@opentiny` packages (e.g., '@opentiny/vue',
'@opentiny/vue-common', '@opentiny/vue-icon') and avoids cross-version mismatch.
♻️ Duplicate comments (3)
packages/vue2-test/vite.config.js (1)
69-80: Make alias resolutions consistently__dirname‑based.
A few entries still resolve relative to the CWD, which can break when running from a different working directory.🔧 Suggested fix
"@opentiny/vue": resolve(__dirname, '../search-box/node_modules/@opentiny/vue'), - "@opentiny/vue-common": resolve('../search-box/node_modules/@opentiny/vue-common'), - '@opentiny/vue-search-box': resolve('../search-box/index.ts'), + "@opentiny/vue-common": resolve(__dirname, '../search-box/node_modules/@opentiny/vue-common'), + '@opentiny/vue-search-box': resolve(__dirname, '../search-box/index.ts'), // 根据模式映射 theme 和 icon // 根据模式映射主题样式文件 - '@opentiny/vue-search-box-theme': resolve(`../search-box/theme${isSaas ? '-saas' : ''}/index.less`), - "@opentiny/vue-theme": resolve(`../search-box/node_modules/@opentiny/vue-theme${isSaas ? '-saas' : ''}`), - "@opentiny/vue-icon": resolve(`node_modules/@opentiny/vue-icon${isSaas ? '-saas' : ''}`) + '@opentiny/vue-search-box-theme': resolve(__dirname, `../search-box/theme${isSaas ? '-saas' : ''}/index.less`), + "@opentiny/vue-theme": resolve(__dirname, `../search-box/node_modules/@opentiny/vue-theme${isSaas ? '-saas' : ''}`), + "@opentiny/vue-icon": resolve(__dirname, `node_modules/@opentiny/vue-icon${isSaas ? '-saas' : ''}`)packages/search-box/vite.config.vue3-saas.ts (1)
50-55: Guard CSS/LESS side‑effect imports from treeshake removal.
moduleSideEffects: falsecan drop style‑only imports; preserve CSS/LESS or theme paths.🔧 Suggested adjustment
treeshake: { - moduleSideEffects: false, + moduleSideEffects: (id) => + /\.(css|less)$/.test(id) || /[\\/](theme|theme-saas)[\\/]/.test(id), propertyReadSideEffects: false, tryCatchDeoptimization: false },Rollup treeshake moduleSideEffects false CSS/LESS side-effect importspackages/search-box/scripts/post-build.js (1)
149-153: Vue3 normal deps still use@opentiny/vue-button; align with consolidated@opentiny/vue.
If Vue3 normal now imports from@opentiny/vue, this package.json will miss the dependency and ship stale versions.🔧 Suggested fix
dependencies: { - '@opentiny/vue-button': '^3.26.0', + '@opentiny/vue': '^3.26.0', '@opentiny/vue-common': '^3.28.0', '@opentiny/vue-icon': '^3.28.0', - '@opentiny/vue-theme': '^3.26.0' + '@opentiny/vue-theme': '^3.28.0' },#!/bin/bash # Verify whether Vue3 normal code imports `@opentiny/vue` vs `@opentiny/vue-button` rg -n "@opentiny/vue-button" packages/search-box rg -n -P "@opentiny/vue(?!-)" packages/search-box
🧹 Nitpick comments (3)
packages/search-box/src/pc.vue (1)
519-531: Remove unused component registrations.
TinyDropdownandTinyDropdownMenuare imported and registered in this component but never used in its template. The child components (TinySearchBoxFirstLevelPanel,TinySearchBoxSecondLevelPanel) only useTinyDropdownItem, which they should import directly if needed.packages/search-box/postcss.config.cjs (1)
9-12: Avoid overwriting an explicitTAILWIND_MODE.If a caller sets
TAILWIND_MODE(e.g., build/watch), this will clobber it. Consider setting only when it’s unset.♻️ Suggested tweak
-if (process.env.TINY_THEME === 'saas' || process.env.TINY_MODE === 'saas') { - process.env.TAILWIND_MODE = 'saas' -} +if ( + (process.env.TINY_THEME === 'saas' || process.env.TINY_MODE === 'saas') && + !process.env.TAILWIND_MODE +) { + process.env.TAILWIND_MODE = 'saas' +}packages/search-box/vite.config.vue3.ts (1)
48-56: Guard CSS side‑effect imports withmoduleSideEffects: false.With
moduleSideEffects: false, Rollup can drop style‑only imports (e.g., injected CSS). Consider whitelisting style modules to avoid missing CSS in the build.♻️ Suggested tweak
treeshake: { - moduleSideEffects: false, + moduleSideEffects: (id) => /\.(css|less)$/.test(id), propertyReadSideEffects: false, tryCatchDeoptimization: false },
| '@opentiny/vue': '^2.28.0', | ||
| '@opentiny/vue-common': '^2.28.0', | ||
| '@opentiny/vue-icon': '^2.28.0', | ||
| '@opentiny/vue-theme': '^3.28.0' |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n packages/search-box/scripts/post-build.jsRepository: opentiny/tiny-search-box
Length of output: 8034
🏁 Script executed:
npm view `@opentiny/vue` versions --json | tail -20
npm view `@opentiny/vue-common` versions --json | tail -20
npm view `@opentiny/vue-icon` versions --json | tail -20
npm view `@opentiny/vue-theme` versions --json | tail -20Repository: opentiny/tiny-search-box
Length of output: 1005
🏁 Script executed:
npm view `@opentiny/vue` versions --json | grep -E '"2\.' | tail -20
npm view `@opentiny/vue-common` versions --json | grep -E '"2\.' | tail -20
npm view `@opentiny/vue-icon` versions --json | grep -E '"2\.' | tail -20Repository: opentiny/tiny-search-box
Length of output: 787
Fix Vue2 dependency version inconsistency: @opentiny/vue-theme should be 2.28.0, not 3.28.0.
In the Vue2 builds (lines 70-73 and 110-113), @opentiny/vue-theme is pinned to ^3.28.0 (Vue3) while all other @opentiny dependencies use ^2.28.0 (Vue2). This cross-version mismatch can cause runtime compatibility issues. Align it to ^2.28.0 for consistency with the Vue2 variant.
All referenced package versions are available on npm.
🤖 Prompt for AI Agents
In `@packages/search-box/scripts/post-build.js` around lines 70 - 73, The package
version for `@opentiny/vue-theme` is incorrectly set to ^3.28.0 for the Vue2
builds; update the dependency strings for '@opentiny/vue-theme' in both Vue2
blocks (the occurrences corresponding to the earlier diff and the later block
around lines 110-113) to '^2.28.0' so it matches the other `@opentiny` packages
(e.g., '@opentiny/vue', '@opentiny/vue-common', '@opentiny/vue-icon') and avoids
cross-version mismatch.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@packages/search-box/package.json`:
- Around line 29-35: The dependency versions are inconsistent: change the
`@opentiny/vue` entry in packages/search-box/package.json from "^2.28.0" to
"^3.28.0" to match `@opentiny/vue-theme` and the rest of the v3 branch (align with
packages/docs/package.json); verify other `@opentiny/`* deps in that file (e.g.,
"@opentiny/vue-common", "@opentiny/vue-icon") are on the intended v3-compatible
versions and update them to the ^3.28.0 range if needed so all OpenTiny packages
target the same major version.
In `@packages/search-box/vite.config.vue2-saas.ts`:
- Around line 110-115: The aggressive treeshake config sets moduleSideEffects:
false and risks stripping side-effectful imports (e.g., `@opentiny/vue`); update
the treeshake block so moduleSideEffects does not blanket-disable side effects —
either set moduleSideEffects: true or provide an explicit list/array that marks
problematic packages as having side effects (e.g., include '@opentiny/vue' in
the array), and keep propertyReadSideEffects and tryCatchDeoptimization as-is;
edit the treeshake object (symbol: treeshake, key: moduleSideEffects) to apply
this change.
In `@packages/search-box/vite.config.vue3.ts`:
- Around line 32-37: Remove the redundant vue$ alias and switch the Vue
distribution to the bundler build: inside the alias object in
vite.config.vue3.ts (and make the same change in vite.config.vue3-saas.ts),
delete the vue$ entry and update the 'vue' mapping from
resolve('node_modules/vue/dist/vue.esm.js') to
resolve('node_modules/vue/dist/vue.esm-bundler.js') so the alias object only
contains 'vue' and the theme alias ('@opentiny/vue-search-box-theme').
♻️ Duplicate comments (5)
packages/search-box/src/components/first-level-panel.vue (1)
178-178: The'click'emit is declared but never emitted in this component.As previously flagged, the
'click'event is added to the emits array but no code path in this component actually emits it. All event handling flows through the'events'emit viahandleEvents. Consider removing'click'from the emits array to avoid confusion about the component's public API.packages/vue2-test/vite.config.js (1)
73-80: Inconsistent path resolution: missing__dirnameprefix on multiple aliases.Line 73 correctly uses
resolve(__dirname, ...), but lines 74, 75, 78, 79, and 80 useresolve(...)without__dirname. This causes inconsistent behavior—paths will resolve from the current working directory instead of relative to this config file.Proposed fix
"@opentiny/vue": resolve(__dirname, '../search-box/node_modules/@opentiny/vue'), - "@opentiny/vue-common": resolve('../search-box/node_modules/@opentiny/vue-common'), - '@opentiny/vue-search-box': resolve('../search-box/index.ts'), + "@opentiny/vue-common": resolve(__dirname, '../search-box/node_modules/@opentiny/vue-common'), + '@opentiny/vue-search-box': resolve(__dirname, '../search-box/index.ts'), // 根据模式映射 theme 和 icon // 根据模式映射主题样式文件 - '@opentiny/vue-search-box-theme': resolve(`../search-box/theme${isSaas ? '-saas' : ''}/index.less`), - "@opentiny/vue-theme": resolve(`../search-box/node_modules/@opentiny/vue-theme${isSaas ? '-saas' : ''}`), - "@opentiny/vue-icon": resolve(`node_modules/@opentiny/vue-icon${isSaas ? '-saas' : ''}`) + '@opentiny/vue-search-box-theme': resolve(__dirname, `../search-box/theme${isSaas ? '-saas' : ''}/index.less`), + "@opentiny/vue-theme": resolve(__dirname, `../search-box/node_modules/@opentiny/vue-theme${isSaas ? '-saas' : ''}`), + "@opentiny/vue-icon": resolve(__dirname, `node_modules/@opentiny/vue-icon${isSaas ? '-saas' : ''}`)packages/search-box/vite.config.vue2-saas.ts (1)
146-148: Non-suffixedvue-template-compileralias may be redundant.The suffixed alias (
'vue-template-compiler$') on line 145 already exists for exact matching. The non-suffixed version on line 146 is only used by therequire()call in this config file. This was flagged in a previous review.packages/search-box/scripts/post-build.js (2)
70-74: Vue2 dependency version mismatch:@opentiny/vue-theme: ^3.28.0with Vue2 packages.The Vue2 Normal build specifies
@opentiny/vue: ^2.28.0but@opentiny/vue-theme: ^3.28.0. This cross-major-version combination may cause compatibility issues. This concern was raised in a previous review and appears unresolved.
110-114: Same version mismatch in Vue2 SaaS build.
@opentiny/vue-theme: ^3.28.0mixed with@opentiny/vue: ^2.28.0- same concern as Vue2 Normal.
🧹 Nitpick comments (1)
packages/vue2-test/vite.config.js (1)
89-98: Simplify redundant ternary expressions inside conditional branches.Within each branch of the
isSaasconditional, the value ofisSaasis already known, making the nested ternary redundant. While functionally correct, this adds unnecessary cognitive load.Proposed simplification
paths: isSaas ? [ // 只包含 theme-saas 目录,不包含 theme 目录 - resolve(__dirname, `../search-box/theme${isSaas ? '-saas' : ''}`), + resolve(__dirname, '../search-box/theme-saas'), ] : [ // 普通模式:包含 theme 目录 - resolve(__dirname, `../search-box/theme${isSaas ? '-saas' : ''}`), + resolve(__dirname, '../search-box/theme'), ],
| // 启用 tree-shaking,确保按需打包 | ||
| treeshake: { | ||
| moduleSideEffects: false, | ||
| propertyReadSideEffects: false, | ||
| tryCatchDeoptimization: false | ||
| }, |
There was a problem hiding this comment.
Same aggressive tree-shaking concern applies here.
As noted for the Vue 3 config, moduleSideEffects: false can cause runtime issues by stripping initialization code from UI component libraries. This is especially concerning for @opentiny/vue which may have side-effectful imports.
🤖 Prompt for AI Agents
In `@packages/search-box/vite.config.vue2-saas.ts` around lines 110 - 115, The
aggressive treeshake config sets moduleSideEffects: false and risks stripping
side-effectful imports (e.g., `@opentiny/vue`); update the treeshake block so
moduleSideEffects does not blanket-disable side effects — either set
moduleSideEffects: true or provide an explicit list/array that marks problematic
packages as having side effects (e.g., include '@opentiny/vue' in the array),
and keep propertyReadSideEffects and tryCatchDeoptimization as-is; edit the
treeshake object (symbol: treeshake, key: moduleSideEffects) to apply this
change.
| alias: { | ||
| 'vue': resolve('node_modules/vue/dist/vue.esm.js'), | ||
| vue$: resolve('node_modules/vue/dist/vue.esm.js') | ||
| vue$: resolve('node_modules/vue/dist/vue.esm.js'), | ||
| // 开发环境和打包环境都支持样式别名导入 | ||
| '@opentiny/vue-search-box-theme': resolve(__dirname, 'theme/index.less') | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
echo "=== Examining vite.config.vue3.ts ==="
fd -t f "vite.config.vue3.ts" | head -5
echo ""
echo "=== Reading vite.config.vue3.ts ==="
TARGET_FILE=$(fd -t f "vite.config.vue3.ts" | head -1)
if [ -n "$TARGET_FILE" ]; then
cat -n "$TARGET_FILE"
else
echo "File not found"
fi
echo ""
echo "=== Checking package.json for Vue version ==="
fd -t f "package.json" packages/search-box | xargs cat 2>/dev/null | head -50
echo ""
echo "=== Checking if node_modules/vue exists and dist structure ==="
if [ -d "node_modules/vue/dist" ]; then
echo "Vue dist files:"
ls -la node_modules/vue/dist | grep -E "\.js$" | head -20
else
echo "Vue dist not available in sandbox"
fiRepository: opentiny/tiny-search-box
Length of output: 192
🏁 Script executed:
#!/bin/bash
echo "=== Verify both 'vue' and 'vue$' aliases in the config ==="
fd -t f "vite.config.vue3.ts" packages/search-box | xargs grep -n -E "(vue'|vue\$)" 2>/dev/null
echo ""
echo "=== Check if there are any references to vue.esm.js or vue$ in the codebase ==="
rg -n -E "(vue\.esm\.js|vue\$)" packages/search-box --type ts --type js 2>/dev/null | head -30
echo ""
echo "=== Look for how Vue is imported/used in the project ==="
fd -t f "\.ts$|\.vue$" packages/search-box/src | xargs grep -l "^import.*from ['\"]vue" 2>/dev/null | head -5Repository: opentiny/tiny-search-box
Length of output: 466
🏁 Script executed:
#!/bin/bash
echo "=== Reading vite.config.vue3.ts with context around line 32-40 ==="
fd -t f "vite.config.vue3.ts" packages/search-box | xargs sed -n '25,45p'
echo ""
echo "=== Full grep for alias section ==="
fd -t f "vite.config.vue3.ts" packages/search-box | xargs grep -n -A 10 "alias:" 2>/dev/null
echo ""
echo "=== Check package.json for Vue version ==="
fd -t f "package.json" -path "*/packages/search-box/*" | xargs cat | grep -A 3 -B 3 '"vue"'Repository: opentiny/tiny-search-box
Length of output: 1313
🏁 Script executed:
#!/bin/bash
echo "=== Check package.json for Vue version (search-box) ==="
cat packages/search-box/package.json | grep -A 5 '"dependencies"' | head -15
echo ""
echo "=== Check if Vue 3 is used (look for version in dependencies) ==="
rg '"vue"' packages/search-box/package.json
echo ""
echo "=== Check Vue documentation for correct dist file ==="
echo "Vue 3 typically uses vue.esm-bundler.js for bundler builds"
echo "Let's verify by checking the root package.json too"
cat package.json | grep -A 2 '"vue"' 2>/dev/null || echo "Root package.json may not exist or no Vue in root"Repository: opentiny/tiny-search-box
Length of output: 703
🏁 Script executed:
#!/bin/bash
echo "=== Search for actual import patterns in the codebase ==="
rg "from ['\"]vue" packages/search-box --type ts --type js -A 1 | head -30
echo ""
echo "=== Check for any other Vue config references ==="
fd -t f "vite.config" packages/search-box | xargs ls -la
echo ""
echo "=== Check if there's a base vite.config or shared config ==="
cat packages/search-box/vite.config.ts 2>/dev/null | head -50Repository: opentiny/tiny-search-box
Length of output: 918
🏁 Script executed:
#!/bin/bash
echo "=== Compare other Vue configs to understand the pattern ==="
echo "--- vite.config.vue2.ts aliases ---"
rg -A 5 "alias:" packages/search-box/vite.config.vue2.ts
echo ""
echo "--- vite.config.vue3-saas.ts aliases ---"
rg -A 5 "alias:" packages/search-box/vite.config.vue3-saas.ts
echo ""
echo "=== Check what the actual intended Vue build should be for Vue 3 ==="
echo "For Vue 3 bundler builds, the correct file is typically vue.esm-bundler.js"
echo "Let's verify by searching for any documentation or comments about Vue distributions"
rg -i "vue\.esm" packages/search-box --type tsRepository: opentiny/tiny-search-box
Length of output: 2129
🌐 Web query:
Vue 3 distribution files esm-bundler
💡 Result:
Short summary
- "esm-bundler" is Vue's ES module build intended to be consumed by JS bundlers (webpack, Rollup, Vite, etc.). It leaves dev/prod branches (process.env.NODE_ENV) intact, is not pre-minified, and imports Vue internal packages as ESM so bundlers can tree-shake and produce a single optimized bundle. [1][2]
When to use
- Use esm-bundler when you build with a bundler (not when loading Vue directly from a CDN via <script> tags). It lets the bundler replace NODE_ENV, perform minification, and tree-shake unused internals. [1][2]
Runtime-only vs runtime+compiler
- There are esm-bundler variants: runtime-only (no template compiler) and runtime+compiler (for compiling templates at runtime). Choose runtime+compiler only if you need in-DOM or string templates; otherwise use runtime-only and precompile SFC templates. [1][2]
Practical notes / config
- If you need the bundler build explicitly, alias 'vue' to the dist file in your bundler config, e.g.:
- Vite/webpack alias: 'vue' -> 'vue/dist/vue.esm-bundler.js'. This ensures SFC tooling and the correct build are resolved. [3][4]
- Be aware some legacy globals or other libs can conflict (edge cases reported when mixing with non-ESM globals). Test integration with other libs. [5]
Sources
[1] npm/Skypack Vue package overview (build variants).
[2] Vue 3 build notes / docs summary (build kinds: global / esm-bundler / cjs).
[3] Vite docs (bundler behavior and pre-bundling).
[4] Example/solution recommending aliasing vue to vue/dist/vue.esm-bundler.js.
[5] Reports/discussions about integration edge-cases (e.g., jQuery conflict).
Remove redundant alias and use correct Vue 3 distribution file.
Lines 33–34 both alias 'vue' and vue$ to the same path (node_modules/vue/dist/vue.esm.js). Remove the redundant vue$ entry.
Additionally, for Vue 3 with Vite, use vue.esm-bundler.js instead of vue.esm.js. The bundler build enables proper tree-shaking and dev/prod environment handling during the build process:
alias: {
'vue': resolve('node_modules/vue/dist/vue.esm-bundler.js'),
'@opentiny/vue-search-box-theme': resolve(__dirname, 'theme/index.less')
}
Also update vite.config.vue3-saas.ts with the same correction.
🤖 Prompt for AI Agents
In `@packages/search-box/vite.config.vue3.ts` around lines 32 - 37, Remove the
redundant vue$ alias and switch the Vue distribution to the bundler build:
inside the alias object in vite.config.vue3.ts (and make the same change in
vite.config.vue3-saas.ts), delete the vue$ entry and update the 'vue' mapping
from resolve('node_modules/vue/dist/vue.esm.js') to
resolve('node_modules/vue/dist/vue.esm-bundler.js') so the alias object only
contains 'vue' and the theme alias ('@opentiny/vue-search-box-theme').
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/search-box/src/components/second-level-panel.vue (1)
359-370: Remove unused'click'emit declaration.The
emitsarray includes'click', but the component never emits it. The parent component (pc.vue) only listens to the@eventslistener. Remove'click'from the emits array on line 361.
🤖 Fix all issues with AI agents
In `@packages/vue2-test/vite.config.js`:
- Around line 89-98: The conditional assigning paths contains a redundant
ternary inside resolve(__dirname, `../search-box/theme${isSaas ? '-saas' : ''}`)
and both branches produce the same array; simplify the logic by removing the
duplicated branches and compute a single paths array (e.g., build a single
resolve(...) entry or derive a suffix variable like themeSuffix = isSaas ?
'-saas' : '' and use it once) so the isSaas check is no longer duplicated;
update the paths assignment where paths is defined to use that single expression
(look for the paths variable and the resolve(...) call in vite.config.js).
♻️ Duplicate comments (5)
packages/search-box/vite.config.vue3.ts (1)
32-37: Remove redundant alias and use correct Vue 3 distribution file.The
vue$alias on line 34 is redundant since line 33 already aliases'vue'. Additionally, for Vue 3 with Vite, usevue.esm-bundler.jsinstead ofvue.esm.jsto enable proper tree-shaking and dev/prod environment handling.Proposed fix
resolve: { alias: { - 'vue': resolve('node_modules/vue/dist/vue.esm.js'), - vue$: resolve('node_modules/vue/dist/vue.esm.js'), + 'vue': resolve('node_modules/vue/dist/vue.esm-bundler.js'), // 开发环境和打包环境都支持样式别名导入 '@opentiny/vue-search-box-theme': resolve(__dirname, 'theme/index.less') }packages/search-box/package.json (1)
29-35: Fix version inconsistency between@opentiny/vueand@opentiny/vue-theme.The dependencies mix v2.x and v3.x packages:
@opentiny/vue,@opentiny/vue-common,@opentiny/vue-icon:~2.28.0(Vue 2 branch)@opentiny/vue-theme,@opentiny/vue-theme-saas:^3.28.0(Vue 3 branch)These are from incompatible major branches. Align all dependencies to the same major version (likely v3.x for Vue 3 support).
packages/search-box/vite.config.vue3-saas.ts (2)
34-38: Remove redundant alias and use correct Vue 3 distribution file.Same issue as in
vite.config.vue3.ts: remove the redundantvue$alias and usevue.esm-bundler.jsfor proper Vue 3 bundler support.Proposed fix
resolve: { alias: { - 'vue': resolve('node_modules/vue/dist/vue.esm.js'), - vue$: resolve('node_modules/vue/dist/vue.esm.js'), + 'vue': resolve('node_modules/vue/dist/vue.esm-bundler.js'), // 开发环境和打包环境都支持样式别名导入 '@opentiny/vue-search-box-theme': resolve(__dirname, 'theme-saas/index.less') }
50-55: Aggressive tree-shaking may drop CSS imports unintentionally.Setting
moduleSideEffects: falsewill remove side-effect-only imports. While theincludeStyleplugin processes CSS externally, consider using a predicate function to preserve CSS/LESS files within the module graph.packages/vue2-test/vite.config.js (1)
73-74: Inconsistent path resolution: missing__dirnameprefix.Line 74 uses
resolve('../search-box/node_modules/@opentiny/vue-common')without__dirname, while line 73 correctly usesresolve(__dirname, ...). This can cause inconsistent resolution depending on the current working directory.Proposed fix
"@opentiny/vue": resolve(__dirname, '../search-box/node_modules/@opentiny/vue'), - "@opentiny/vue-common": resolve('../search-box/node_modules/@opentiny/vue-common'), + "@opentiny/vue-common": resolve(__dirname, '../search-box/node_modules/@opentiny/vue-common'),
🧹 Nitpick comments (3)
packages/search-box/src/composables/use-match.ts (1)
2-2: Unused import:Loadingis only referenced in commented-out code.The
Loadingimport is not used anywhere in active code—its only references are in the commented-out loading functionality (lines 37, 40-47). Either remove the import or uncomment the loading logic if it's intended to be used.♻️ Option 1: Remove unused import
-import { Loading } from '@opentiny/vue'♻️ Option 2: Uncomment the loading functionality if needed
export function useMatch({ props, state, emit, nextTick }) { - // const loadingInstance = ref(null) + const loadingInstance = ref(null) const getMatchList = async (keyword: string) => { - // if (typeof document !== 'undefined') { - // !loadingInstance.value && - // (loadingInstance.value = Loading.service({ - // target: document.getElementById('potential-loading') - // })) - // } + if (typeof document !== 'undefined') { + !loadingInstance.value && + (loadingInstance.value = Loading.service({ + target: document.getElementById('potential-loading') + })) + } state.potentialOptions = await props.potentialOptions.getMatchList(keyword) - // loadingInstance.value && loadingInstance.value.close() + loadingInstance.value && loadingInstance.value.close() showDropdown(state, true) }Note: If uncommenting, also uncomment the
refimport on line 1.packages/search-box/vite.config.vue2.ts (1)
108-113: Aggressive tree-shaking may drop side-effect-only imports.Same concern as the Vue 3 configs:
moduleSideEffects: falsewill drop any module imported purely for side effects. Consider using a predicate to preserve CSS/LESS files:moduleSideEffects: (id) => /\.(css|less)$/.test(id)packages/vue3-test/vite.config.js (1)
29-39: Redundant conditional: both branches produce identical LESS paths.Both the
isSaasand!isSaasbranches use the same expressiontheme${isSaas ? '-saas' : ''}, making the outer conditional unnecessary. The ternary inside already handles the mode distinction.♻️ Simplify by removing the redundant conditional
less: { javascriptEnabled: true, - // Saas 模式下,限制路径解析,避免自动引入 theme/vars.less - paths: isSaas - ? [ - // 只包含 theme-saas 目录,不包含 theme 目录 - resolve(`../../packages/search-box/theme${isSaas ? '-saas' : ''}`), - ] - : [ - // 普通模式:包含 theme 目录 - resolve(`../../packages/search-box/theme${isSaas ? '-saas' : ''}`), - ], + paths: [ + resolve(`../../packages/search-box/theme${isSaas ? '-saas' : ''}`), + ], },
| // Saas 模式下,限制路径解析,避免自动引入 theme/vars.less | ||
| paths: isSaas | ||
| ? [ | ||
| // 只包含 theme-saas 目录,不包含 theme 目录 | ||
| resolve(__dirname, `../search-box/theme${isSaas ? '-saas' : ''}`), | ||
| ] | ||
| : [ | ||
| // 普通模式:包含 theme 目录 | ||
| resolve(__dirname, `../search-box/theme${isSaas ? '-saas' : ''}`), | ||
| ], |
There was a problem hiding this comment.
Redundant ternary: both branches resolve to the same path.
Both branches of the isSaas conditional evaluate to the same path expression because isSaas ? '-saas' : '' is used inside both. The condition is therefore ineffective.
Proposed fix - simplify to single path
less: {
javascriptEnabled: true,
- // Saas 模式下,限制路径解析,避免自动引入 theme/vars.less
- paths: isSaas
- ? [
- // 只包含 theme-saas 目录,不包含 theme 目录
- resolve(__dirname, `../search-box/theme${isSaas ? '-saas' : ''}`),
- ]
- : [
- // 普通模式:包含 theme 目录
- resolve(__dirname, `../search-box/theme${isSaas ? '-saas' : ''}`),
- ],
+ // 根据模式限制路径解析,避免跨主题引入
+ paths: [
+ resolve(__dirname, `../search-box/theme${isSaas ? '-saas' : ''}`),
+ ],
},🤖 Prompt for AI Agents
In `@packages/vue2-test/vite.config.js` around lines 89 - 98, The conditional
assigning paths contains a redundant ternary inside resolve(__dirname,
`../search-box/theme${isSaas ? '-saas' : ''}`) and both branches produce the
same array; simplify the logic by removing the duplicated branches and compute a
single paths array (e.g., build a single resolve(...) entry or derive a suffix
variable like themeSuffix = isSaas ? '-saas' : '' and use it once) so the isSaas
check is no longer duplicated; update the paths assignment where paths is
defined to use that single expression (look for the paths variable and the
resolve(...) call in vite.config.js).
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/vue3-test/package.json`:
- Around line 28-30: Package lists tailwindcss, postcss, and autoprefixer but
lacks their config files; either add tailwind.config.js and postcss.config.js to
the packages/vue3-test/ directory or remove those devDependencies if unused.
Create a minimal tailwind.config.js exporting content paths for this package and
any component directories plus the required plugins/settings, and create a
postcss.config.js that loads "tailwindcss" and "autoprefixer" as plugins; update
package.json scripts if necessary to run Tailwind builds (e.g., via "build:css")
or remove the three packages from devDependencies if the package doesn't use
Tailwind.
♻️ Duplicate comments (5)
packages/search-box/scripts/post-build.js (1)
70-73: Vue2 builds use@opentiny/vue-theme: ^3.28.0which may be incompatible.The Vue2 Normal and Vue2 Saas builds declare
@opentiny/vue-theme: '^3.28.0'while all other Vue2 dependencies use^2.28.0. The theme package v3.x targets Vue 3 ecosystem. This version mismatch was flagged in a previous review and remains unaddressed.🔧 Proposed fix to align Vue2 theme version
dependencies: { '@opentiny/vue': '^2.28.0', '@opentiny/vue-common': '^2.28.0', '@opentiny/vue-icon': '^2.28.0', - '@opentiny/vue-theme': '^3.28.0' + '@opentiny/vue-theme': '^2.28.0' },packages/search-box/vite.config.vue3.ts (1)
33-36: Switch Vue 3 alias to the bundler build and drop the redundantvue$entry.For Vite + Vue 3,
vue.esm-bundler.jsis the intended build;vue$duplicatesvueand can be removed.♻️ Suggested update
alias: { - 'vue': resolve('node_modules/vue/dist/vue.esm.js'), - vue$: resolve('node_modules/vue/dist/vue.esm.js'), + 'vue': resolve('node_modules/vue/dist/vue.esm-bundler.js'), // 开发环境和打包环境都支持样式别名导入 '@opentiny/vue-search-box-theme': resolve(__dirname, 'theme/index.less') }packages/search-box/vite.config.vue2-saas.ts (2)
150-152: Verify the need for the non‑suffixedvue-template-compileralias.If nothing imports the non‑suffixed name, consider removing it to reduce alias noise.
♻️ Suggested cleanup
'vue-template-compiler$': resolve(__dirname, 'node_modules/vue-template-compiler'), - 'vue-template-compiler': resolve(__dirname, 'node_modules/vue-template-compiler'), // 开发环境和打包环境都支持样式别名导入 '@opentiny/vue-search-box-theme': resolve(__dirname, 'theme-saas/index.less')
110-126: Tree‑shaking still risks stripping CSS/LESS side‑effects.Same concern as earlier:
moduleSideEffects: falsecan remove style-only imports.packages/search-box/vite.config.vue3-saas.ts (1)
50-66: Tree‑shaking can strip CSS/LESS side‑effects.Same concern as noted previously:
moduleSideEffects: falsemay remove style-only imports.
🧹 Nitpick comments (4)
packages/search-box/package.json (1)
29-34: Verify mixed version specifiers (~vs^) are intentional.The dependencies use
~2.28.0(patch-only) forvue-commonandvue-icon, but^2.28.0(minor updates) forvue. This asymmetry may cause compatibility drift if minor versions introduce breaking changes in the umbrella package while pinning the underlying packages to patches.Consider aligning all to either
~or^for consistency, unless there's a specific reason for the mixed approach.packages/vue3-test/vite.config.js (1)
30-38: Simplify redundant Less paths configuration.The outer
isSaasternary and the inner${isSaas ? '-saas' : ''}in the template literal produce the same result but are unnecessarily complex. Both branches compute identical arrays.♻️ Suggested simplification
preprocessorOptions: { less: { javascriptEnabled: true, - // Saas 模式下,限制路径解析,避免自动引入 theme/vars.less - paths: isSaas - ? [ - // 只包含 theme-saas 目录,不包含 theme 目录 - resolve(`../../packages/search-box/theme${isSaas ? '-saas' : ''}`), - ] - : [ - // 普通模式:包含 theme 目录 - resolve(`../../packages/search-box/theme${isSaas ? '-saas' : ''}`), - ], + // 根据模式选择 theme 或 theme-saas 目录 + paths: [ + resolve(`../../packages/search-box/theme${isSaas ? '-saas' : ''}`), + ], }, },packages/search-box/src/components/second-level-panel.vue (1)
361-361: Consider removing unusedclickemit declaration.The
clickevent is declared in emits but doesn't appear to be emitted anywhere in the component. If this is for future use or event forwarding, consider adding a comment; otherwise, remove the unused declaration.packages/search-box/vite.config.vue3-saas.ts (1)
34-38: Use the Vue 3 bundler build and drop the redundantvue$alias.
vue.esm-bundler.jsis the recommended build for bundlers like Vite.♻️ Suggested update
alias: { - 'vue': resolve('node_modules/vue/dist/vue.esm.js'), - vue$: resolve('node_modules/vue/dist/vue.esm.js'), + 'vue': resolve('node_modules/vue/dist/vue.esm-bundler.js'), // 开发环境和打包环境都支持样式别名导入 '@opentiny/vue-search-box-theme': resolve(__dirname, 'theme-saas/index.less') }
| "tailwindcss": "^3.4.14", | ||
| "postcss": "^8.4.47", | ||
| "autoprefixer": "^10.4.20" |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check for Tailwind and PostCSS configuration files in the vue3-test package
echo "=== Checking for configuration files in packages/vue3-test ==="
fd -t f '(tailwind|postcss)\.config\.(js|cjs|mjs|ts)$' packages/vue3-test
echo ""
echo "=== Checking for configuration files at repository root (may be shared) ==="
fd -t f '(tailwind|postcss)\.config\.(js|cjs|mjs|ts)$' --max-depth 1 .
echo ""
echo "=== Checking if Tailwind directives are used in CSS files ==="
rg -l '@tailwind' packages/vue3-test --type css --type vue 2>/dev/null || echo "No `@tailwind` directives found"
echo ""
echo "=== List all config files in packages/vue3-test root ==="
ls -la packages/vue3-test/ | grep -E '(config|\.)'Repository: opentiny/tiny-search-box
Length of output: 908
Add Tailwind and PostCSS configuration files.
The dependencies tailwindcss, postcss, and autoprefixer have been added to devDependencies, but their required configuration files are missing. These tools require tailwind.config.js and postcss.config.js files to function properly. Create these configuration files in packages/vue3-test/ or explain if these dependencies are not actually needed for this package.
🤖 Prompt for AI Agents
In `@packages/vue3-test/package.json` around lines 28 - 30, Package lists
tailwindcss, postcss, and autoprefixer but lacks their config files; either add
tailwind.config.js and postcss.config.js to the packages/vue3-test/ directory or
remove those devDependencies if unused. Create a minimal tailwind.config.js
exporting content paths for this package and any component directories plus the
required plugins/settings, and create a postcss.config.js that loads
"tailwindcss" and "autoprefixer" as plugins; update package.json scripts if
necessary to run Tailwind builds (e.g., via "build:css") or remove the three
packages from devDependencies if the package doesn't use Tailwind.
适配演练场,优化本地开发环境saas模式以及css导入逻辑,替换为直接导入@opentiny/vue,优化打包
Summary by CodeRabbit
New Features
Improvements
Chores
✏️ Tip: You can customize this high-level summary in your review settings.