Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript compression breaks sveltekit app #97

Closed
ZakkProjects opened this issue Aug 24, 2023 · 3 comments
Closed

Javascript compression breaks sveltekit app #97

ZakkProjects opened this issue Aug 24, 2023 · 3 comments

Comments

@ZakkProjects
Copy link

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

@georges-gomes
Copy link
Member

georges-gomes commented Aug 24, 2023

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

@ZakkProjects
Copy link
Author

ZakkProjects commented Aug 25, 2023

Sorry i've updated it to public now.

@georges-gomes
Copy link
Member

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 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants