-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
I am using vite's resolve.alias for aliasing my files. below is my config
export default defineConfig({
resolve: {
alias: [
{
find: "#WC",
replacement: "./src/WC.ts",
},
{
find: "#globals.css",
replacement: "./src/styles/globals.css.ts"
}
],
},All working perfectly except the #globals.css.
It shows the below error
[commonjs--resolver] Missing "#globals.css?used" specifier in "my-pkg" package
error during build:
Error: Missing "#globals.css?used" specifier in "my-pkg" packageBut if I replace my alias from #globals.css → #globals.css?used all works fine. but the same issue is not occurring for other imports alias
Reproduction
https://stackblitz.com/edit/vitejs-vite-encmtd
https://stackblitz.com/edit/vitejs-vite-pseonw?file=counter.js
Steps to reproduce
No response
System Info
System:
OS: macOS 13.3.1
CPU: (8) arm64 Apple M2
Memory: 143.58 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 19.6.1 - /opt/homebrew/bin/node
npm: 9.6.4 - /opt/homebrew/bin/npm
Browsers:
Safari: 16.4Used Package Manager
pnpm
Logs
Click to expand!
[commonjs--resolver] Missing "#bar.css?used" specifier in "vite-starter" package
error during build:
Error: Missing "#bar.css?used" specifier in "vite-starter" package
at e (file://file:///home/projects/vitejs-vite-encmtd/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:16701:25)
at n (file://file:///home/projects/vitejs-vite-encmtd/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:16701:627)
at f (file://file:///home/projects/vitejs-vite-encmtd/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:16701:1357)
at resolveExportsOrImports (file://file:///home/projects/vitejs-vite-encmtd/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:23459:20)
at resolveSubpathImports (file://file:///home/projects/vitejs-vite-encmtd/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:22996:23)
at Object.resolveId (file://file:///home/projects/vitejs-vite-encmtd/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:22803:37)
at eval (file://file:///home/projects/vitejs-vite-encmtd/node_modules/rollup/dist/es/shared/node-entry.js:24576:40)
at async PluginDriver.hookFirstAndGetPlugin (file://file:///home/projects/vitejs-vite-encmtd/node_modules/rollup/dist/es/shared/node-entry.js:24476:28)
at async resolveId (file://file:///home/projects/vitejs-vite-encmtd/node_modules/rollup/dist/es/shared/node-entry.js:23373:26)
at async ModuleLoader.resolveId (file://file:///home/projects/vitejs-vite-encmtd/node_modules/rollup/dist/es/shared/node-entry.js:23637:15)
ELIFECYCLE Command failed with exit code 1.Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)