Closed maicol07 closed 2 years ago
We can't skip analysis on excluded dependencies just like that, the dependency would break at runtime since it's importing a non-existent path not handled by the dev server. If this behaviour is desired so it works with import maps, I think we should keep track of #2483 instead and find a solution that tackles this feature without a breaking change.
Closing in favour of #2483
Describe the bug
An import of the dependency contained in
optimizeDeps.exclude
shouldn't be analyzed when using the dev server, since when building there isn't this issue. Related to #2483Reproduction
Write an import map and try to import the related module in your
app.js
loaded with Vite. build command works fine, the dev server throws the error.System Info
Used Package Manager
pnpm
Logs
Validations