Svelte await blocks cause breaking errors in Terser's compression step
igneosaur opened this issue · 6 comments
Problem?
Terser is doing its thing for production builds. It carries out a second compression on bundle.js that results in a breaking JS error if any Svelte files contain {#await ...}
blocks.
Recreate the bug
- Add a Svelte file with an await block into your application
- Run a production build
npm run build
- Serve up the public directory
- Observe dead site
Fix
Since the second pass of compression on bundle.js is superfluous and causes a bug, it should be removed from the Terser plugin's build step. #58
It works good the await for me with default terser()
call.
Can you push a reproduction on github?
I saw the repo. I'm trying to understand the problem.
I found the problem: is not terser.
The problem is with sveltejs: 3.9.1
.
With sveltejs: 3.9.0
it works fine!
We should open an issue.
Opened: sveltejs/svelte#3483.
Please do not remove your fork, @igneosaur. Thanks.
Closing this in favor of this issue, which perhaps can be used to try to narrow down a repro to open against Terser.