Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

vite-node issue

Reproduction

To reproduce the issue:

npm clean-install && npx vite-node src/issue.js
Output
added 43 packages, and audited 44 packages in 1s

7 packages are looking for funding
  run `npm fund` for details

7 vulnerabilities (1 moderate, 6 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
node:internal/modules/esm/resolve:274
    throw new ERR_MODULE_NOT_FOUND(
          ^

Error: Cannot find module '/workspaces/vite-node-issue/node_modules/.vite/deps/svelte_internal_disclose-version.js' imported from /workspaces/vite-node-issue/node_modules/vite-node/dist/client-CyS7w_FB.mjs
    at finalizeResolution (node:internal/modules/esm/resolve:274:11)
    at moduleResolve (node:internal/modules/esm/resolve:864:10)
    at defaultResolve (node:internal/modules/esm/resolve:990:11)
    at ModuleLoader.#cachedDefaultResolve (node:internal/modules/esm/loader:737:20)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:714:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:293:38)
    at onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:665:36)
    at TracingChannel.tracePromise (node:diagnostics_channel:350:14)
    at ModuleLoader.import (node:internal/modules/esm/loader:664:21)
    at defaultImportModuleDynamicallyForModule (node:internal/modules/esm/utils:224:31) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///workspaces/vite-node-issue/node_modules/.vite/deps/svelte_internal_disclose-version.js'
}

Node.js v24.11.1

Workaround

You can use vite optimize like this to get it to work:

npm clean-install && npx vite optimize && npx vite-node src/issue.js

but then you get a deprecation warning.

Output
manually calling optimizeDeps is deprecated. This is done automatically and does not need to be called manually.

Important note

If you comment out root: 'src' in vite.config.js, the issue goes away.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages