Closed bushuizaijian closed 2 weeks ago
Start a new pull request in StackBlitz Codeflow.
Do you have any issue on your application after build? Otherwise, I think this is due to rollup's tree-shaking and having an empty chunk is only a minor inconvenience/limitation of rollup's manualChunks
, so it's probably a rollup side issue at best.
I made a repro here https://github.com/hi-ogawa/reproductions/tree/main/vite-17694-rollup-manualChunks-empty where vite/rollup generates an empty chunk which is not "harmful":
// src/main.js
console.log("hello");
if (0) {
console.log(import("lodash"));
}
$ npx vite build
vite v5.4.2 building for production...
✓ 7 modules transformed.
Generated an empty chunk: "lodash".
dist/vite/index.html 0.38 kB │ gzip: 0.26 kB
dist/vite/js/lodash-l0sNRNKZ.js 0.00 kB │ gzip: 0.02 kB
dist/vite/js/index-Bg9QWlBW.js 1.28 kB │ gzip: 0.53 kB
✓ built in 201ms
$ npx rollup -c rollup.config.js
./src/main.js → dist/rollup...
(!) Generated an empty chunk
"lodash"
created dist/rollup in 173ms
I'll close this issue for now. If you have a concrete issue in the application after build, please provide more details.
Describe the bug
After adding the manualChunks configuration, the packaging will display the described content
Reproduction
https://stackblitz.com/edit/vitejs-vite-cdt85l?file=vite.config.js
Steps to reproduce
No response
System Info
Used Package Manager
npm
Logs
No response
Validations