-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Labels
feat: deps optimizerEsbuild Dependencies OptimizationEsbuild Dependencies Optimizationp2-nice-to-haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)
Description
Describe the bug
Given the following dynamic import within a dependency located on localhost:3000/node_modules/.vite/deps/chunk-HCOQKIU7.js:
// node_modules/@blueprintjs/icons/lib/esnext/iconLoader.js
var defaultIconPathsLoader = async(name,size)=>{
return (await import(/* webpackInclude: /\.js$/ */
/* webpackMode: "lazy-once" */
`./generated/${size}px/paths/${name}`)).default;
}There are two problems:
TheDuplicate of Dynamic imports with variables in a dependency are not processed at all #6179.importpath does not resolve correctly, because it’s no longer relative to the original module path.- When vite fails to resolve the path, it returns an erroneous error message (504 Outdated Optimize Dep, please reload the page) instead of 404. The culprit code is here.
Reproduction
https://codesandbox.io/p/sandbox/hopeful-brattain-gz4per
Steps to reproduce
See CodeSandbox link above.
System Info
System:
OS: Linux 5.15 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
CPU: (2) x64 AMD EPYC
Memory: 474.37 MB / 2.01 GB
Container: Yes
Shell: 5.8 - /bin/zsh
Binaries:
Node: 18.16.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.5.1 - /usr/local/bin/npm
npmPackages:
@vitejs/plugin-react: ^4.0.0 => 4.0.0
vite: ^4.3.9 => 4.3.9Used Package Manager
yarn
Logs
No response
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
feat: deps optimizerEsbuild Dependencies OptimizationEsbuild Dependencies Optimizationp2-nice-to-haveNot breaking anything but nice to have (priority)Not breaking anything but nice to have (priority)