Reproduction link or steps
REPL
What is expected?
lazy-BUetEruU.js is not output because it is not used in root.js.
What is actually happening?
lazy-BUetEruU.js is output.
System Info
Any additional comments?
If you set output.minify: false, you can see that the dynamic import is still there. This means the dynamic import is removed in the minification step.
Originally reported at vitejs/vite#21968
Reproduction link or steps
REPL
What is expected?
lazy-BUetEruU.jsis not output because it is not used inroot.js.What is actually happening?
lazy-BUetEruU.jsis output.System Info
Any additional comments?
If you set
output.minify: false, you can see that the dynamic import is still there. This means the dynamic import is removed in the minification step.Originally reported at vitejs/vite#21968