Closed cyyynthia closed 1 week ago
Yo @cyyynthia ! Thanks again for this! I totally understand the benefit of having sourceMap, however the thought of another additional 3mb for package size is still haunting me 😬
But seeing that react-aria is 16mb, I think we can get this baby in!
Well, to be fair given there isn't any mangling going on anymore I wouldn't find it horrible to not have source maps, in which case this PR saves 2.5MB!
I honestly don't have much opinion about whether the maps are important or not, I pretty much did it as I saw there was some demand 😅
I really do dig the concern for bundle size though! A lost art these days 💫
This PR supersedes and closes #1102
It does not use the same approach as proposed in #1102 however; seeing the current v2 build uses
preserveModules
. However, because of how the SFC gets split in multiple virtual chunks this causes a lot of unwanted files to clutter the build making it larger than it needs to be.The approach proposed in this PR mitigates it by using manualChunks to achieve the intended result of a 1:1 mapping between Vue files and the resulting JS files. A little hack has been introduced as well to properly name chunk files with the right file extension and without a hash.
Minification has been disabled: along with the drop of hashes the intent is to make eventual dependency patches less brittle (see last comment of #908 for a use-case). This is also yet-another-attempt at building with sourcemaps enabled 😄
Package size measurements: measured by running
pnpm run build-only; du -sh dist
inpackages/core
.[^1]: these numbers were obtained by replacing the manual chunking approach from this PR by the manual chunking approach used in #1102. Does not include the more heavy-handed dual config approach for esm and cjs.