-
-
Notifications
You must be signed in to change notification settings - Fork 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
Can't build SvelteKit component libraries with "moduleResolution": "NodeNext"
#5387
Can't build SvelteKit component libraries with "moduleResolution": "NodeNext"
#5387
Comments
Mhhm that's strange, @bluwy didn't Vite add support for resolving |
Yeah we did have support, but it looks like a different issue based on the logs that the esbuild scanner is not resolving |
Dug into this. Looks like it's a bug in the scanner where we didn't implement the heuristic explained in the above comment when scanning. I'm making a PR to fix this upstream. |
Closing as this has been fixed in Vite and will be released in the next beta. Vite 3 stable is coming soon too so it won't be long when the changes propagate here. |
@bluwy Please don't close this because this issue is still there even using vite beta |
Vite haven't published a new beta with the fix yet, or are you using the |
I thought it'd be fine to try on ❯ pnpm run dev
> @@0.0.2 dev /home/nato/Code/github.com/
> vite dev
node:internal/errors:477
ErrorCaptureStackTrace(err);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/nato/Code/github.com//node_modules/.pnpm/@gitpkg.now.sh+vitejs+vite+packages@vite+5c6cf5a2a6577fb8e8ecc66a0411143af3fed042/node_modules/vite/dist/node/cli.js' imported from /home/nato/Code/github.com//node_modules/.pnpm/@gitpkg.now.sh+vitejs+vite+packages@vite+5c6cf5a2a6577fb8e8ecc66a0411143af3fed042/node_modules/vite/bin/vite.js
at new NodeError (node:internal/errors:388:5)
at finalizeResolution (node:internal/modules/esm/resolve:405:11)
at moduleResolve (node:internal/modules/esm/resolve:966:10)
at defaultResolve (node:internal/modules/esm/resolve:1174:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:605:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:318:18)
at ESMLoader.import (node:internal/modules/esm/loader:404:22)
at importModuleDynamically (node:internal/modules/esm/translators:106:35)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
at start (file:///home/nato/Code/github.com//node_modules/.pnpm/@gitpkg.now.sh+vitejs+vite+packages@vite+5c6cf5a2a6577fb8e8ecc66a0411143af3fed042/node_modules/vite/bin/vite.js:44:3) {
code: 'ERR_MODULE_NOT_FOUND'
}
Node.js v18.4.0
ELIFECYCLE Command failed with exit code 1. Perhaps it has to be published to be usable? Or maybe |
Perhaps you need to use custom scripts, though I've never used gitpkg (pretty cool though). But Vite should have a beta up soon. Though even so, Vite 3 is a major bump, so there may be breaking changes which are handled at #5005 and sveltejs/vite-plugin-svelte#359. I'd suggest sticking with the workaround for now though. |
Does this issue persist now that we moved to Vite 3? |
It works fine, thanks! |
Describe the bug
When importing a TypeScript file with
"moduleResolution": "NodeNext"
, an error occurs which prevents building SvelteKit apps.These are the important files to reproduce the issue.
tsconfig.json
src/routes/index.svelte
src/lib/utils/hello_world.ts
Reproduction
Project:
https://github.com/NatoBoram/sk-import-dotjs-in-ts
Reproduction steps:
git clone git@github.com:NatoBoram/sk-import-dotjs-in-ts.git cd sk-import-dotjs-in-ts pnpm i pnpm run build
Logs
System Info
Severity
blocking all usage of SvelteKitCan be worked around by running
tsc
(ortsc --watch
) in the workspace. Those files can be deleted withtsc --build --clean
.Additional Information
The commands that fail are these:
References
.js
extensions are present with Typescript 5 cli#205The text was updated successfully, but these errors were encountered: