-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
SWC Compress + Svelte = Error #6780
Comments
This is bug of swc |
@kdy1 But what is it caused by, as-in what's it doing wrong, eliminating too much code? |
I don't know. I didn't investigate it yet |
Ah okay, it seemed you knew because of the fast reply. 👍 |
🙏 Waw that was fast. Fingers crossed NextJS pulls this in asap. |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Describe the bug
I don't know wether this problem originates in Svelte or in SWC, I lean towards SWC.
When I enable
compress
in the.swcrc
config and then compress a Svelte built target the resulting file will throw an error when loaded in a browser.I've set up a repository here: https://github.com/rikschennink/swc-svelte-problem
I ran into this because NextJS has enabled SWC to compress JS and since that time my Svelte based library can no longer be used with NextJS unless NextJS is configured to use Terser as JS compressor.
Input code
No response
Config
Playground link
No response
Expected behavior
It should work with and without
compress
enabledActual behavior
When
compress
is enabled the Svelte app no longer loads and throws the following error:This error is thrown because
current_component.$$
(Svelte specific) is somehow missing.We can circumvent this by passing
context: []
to the App constructor but now the error will be thrown on the App child component.Version
1.3.25
Additional context
No response
The text was updated successfully, but these errors were encountered: