divriots/jampack

Javascript compression breaks sveltekit app

ZakkProjects opened this issue · 3 comments

Hi,

Im using jampack to compress static image assets to webp and avif formats for my svelte app. (Svelte is configured as SSG)
But while compressing js files there is a lot of imports and variable renaming (I'm not familiar with SWC internals).

As a result the svelte app fails during hydratation with "read properties of undefined".

Also most apps built with Vite already have good enough compression of .js and .html files resulting in the final file size savings of less than 1%.

It would be really cool thing to have simple toggles in jampack config to disable certain features.
Just like options --fast, --onlyoptim and --onlycomp do.
(Which is already requested here: #91)

As a current workaround i use the existing CLI option --exclude **/*.js .

As requested on discord by @georges-gomes i've also made replication of the svelte problem using svelte demo app to allow you to further address javascript compression problem.

https://github.com/ZakkProjects/jampack-js-compess-issue

hi @ZakkProjects thanks for the issue! Can you make the project jampack-js-compess-issue public? Many thanks

Sorry i've updated it to public now.

I can't find a way to make @swc/core minify js properly for svelte generated code. Svelte code is already properly minified so your solution is the way to go for the moment: --exclude **/*.js.

Thanks for reporting and sharing the project 🙏