Description
Hello,
I'm 100% sure this is something I'm doing wrong but I was wondering if someone can point me in the right direction?
I'm coming from a webpack config, if that helps.
Here is my esbuild command:
npx esbuild src/js/theme.js --bundle --define:process.env.NODE_ENV=\"production\" --sourcemap --minify --analyze --splitting --format=esm --outdir=js
I'm using codesplitting so I can dynamically load chunks when they're needed. I'm using the dynamic import() function. This actually works great. Those chunks look like this in the --analyze output:
js/program-explorer-W7FFKVTU.js 20.1kb 100.0%
└ src/modules/program-explorer/program-explorer.tsx 19.8kb 98.4%
However, I'm also getting "unintended" chunks. I am not loading them dynamically in any way that I'm aware of - they're being imported with plain old static import. The outputted chunks look like the following. Notably, the chunks have no real name in the prefix.
js/chunk-JPIFNYYQ.js 2.4kb 100.0%
├ src/modules/course-popup/course-popup.jsx 1.4kb 57.7%
└ src/modules/ewu-popup/ewu-popup.jsx 900b 36.8%
I guess my expectation is that when I use static import, the bundler would inline those modules rather than splitting and dynamically loading them. And I can't figure out why these statically loaded modules are being split into chunks.