Poor tree-shaking #1953
Labels
help wanted
Extra attention is needed
investigate
The issue needs further investigating
svelte
Related to the svelte adapter
vue 3
Related to the vue 3 adapter
Version:
@inertiajs/svelte
version: 1.2.0Describe the problem:
1. The router
Just importing the router (
@inertiajs/core
) instantly adds 110KB to the final, minified uncompressed, "lib" in Svelte.==> allow for a better tree-shaking of the router, as it shouldn't weigh 110KB minified (it probably includes some axios stuff and also other modules that increase weight)
I don't yet have a workaround for reducing output file when using the
router
(which is almost mandatory in any real app), but would definitely be grateful for one2. useForm
Also, importing any module from
@inertiajs/svelte
prevents tree-shaking from removing unneeded stuff (e.g.useForm
, which adds 30KB minified uncompressed because oflodash
, even when we never useuseForm
)==> maybe either use
lodash-es
, or don't includeuseForm
inindex.js
What I ended up doing is importing single
.js
files directly, e.g.:Steps to reproduce:
Just import
Inertia
and check output file weight (using lib mode)The text was updated successfully, but these errors were encountered: