-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
asset-import-meta-url
incorrectly tries to resolve assets
#14169
Comments
Start a new pull request in StackBlitz Codeflow. |
Duplicate of #8427 |
@sapphi-red I believe this is not the same issue. |
The underlying problem is same: On second thought, this issue could be a separate one. As I think it won't be solved even if #8427 was solved.
Because The workaround is same with #8427 (exclude from dep optimization) but I guess it won't work in some cases even with that. |
Any resolution for this? I'm having the same problem. |
I'm not sure if this is really a duplicate of #13530. However, the other issue is closed so I ask here. I get an error since Vite 5:
Reproduction: https://stackblitz.com/edit/github-rjaduf-38mdms?file=src%2Fpages%2FHome.vue The workaround with |
@WolfgangDrescher The error reported at #13530 is a duplicate of this issue. But that |
@danielroe gave an update on nuxt/nuxt#21578. Since this is a duplicate of #13530 probably this issue is already resolved. I did upgrade Vite in my reproduction repo to https://stackblitz.com/edit/github-rjaduf-caswxa?file=package.json |
I upgraded vite to version 5 and retested the case; it appears to have been resolved. Should we close this issue? |
Thanks for the report. It seems to be fixed by #14626. |
Describe the bug
keywords:
Cannot use
import.meta.url
to calculate path.The vite plugin asset-import-meta-url is trying to resolve the asset and throw errors.
This bug only exists in the installed npm package and cannot be reproduced using the local link (pnpm link) method. Therefore, when trying to reproduce the bug, please directly move
foo
to the node_modules directory.Reproduction
https://stackblitz.com/edit/vitejs-vite-9ysjmo?file=index.js
Steps to reproduce
You can download this tgz file and reproduce the bug according to the README.
minimal reproducible example: vite-bug-utl-0.0.0.tgz
Background: I am working at https://www.npmjs.com/package/@wasm-fmt/clang-format .
System Info
Used Package Manager
pnpm
Logs
[vite] Internal server error: Failed to resolve entry for package "/Users/akari/Developer/vite-bug-url/node_modules/.vite/deps". The package may have incorrect main/module/exports specified in its package.json.
Plugin: vite:asset-import-meta-url
File: /Users/akari/Developer/vite-bug-url/node_modules/.vite/deps/foo.js?v=7f02c688
at packageEntryFailure (file:///Users/akari/Developer/vite-bug-url/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-df561101.js:28691:11)
at resolvePackageEntry (file:///Users/akari/Developer/vite-bug-url/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-df561101.js:28688:5)
at tryCleanFsResolve (file:///Users/akari/Developer/vite-bug-url/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-df561101.js:28349:28)
at tryFsResolve (file:///Users/akari/Developer/vite-bug-url/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-df561101.js:28296:17)
at TransformContext.transform (file:///Users/akari/Developer/vite-bug-url/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-df561101.js:43166:32)
at Object.transform (file:///Users/akari/Developer/vite-bug-url/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-df561101.js:44283:62)
at async loadAndTransform (file:///Users/akari/Developer/vite-bug-url/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-df561101.js:54950:29)
at async viteTransformMiddleware (file:///Users/akari/Developer/vite-bug-url/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-df561101.js:64345:32)
Validations
The text was updated successfully, but these errors were encountered: