-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix(es/minifier): Don't remove exports #7856
Conversation
|
b890409
to
70d8586
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
swc-bump:
- swc_ecma_minifier
Oops, this seems to be causing some new issues around comments being moved to the wrong places... Working on a test case and fix. |
@kdy1 looks like we commented at the same time haha... Closing for now to make sure this doesn't get merged as is since it's causing some issues in my local testing. Working on an update, will reopen once it's ready for another look! |
Pull request was closed
Got it, will keep looking into the issue from my side, and send in another PR if needed! :) |
@lewisl9029 Please enable |
Hey @kdy1, didn't realize this before, but it looks like GitHub doesn't actually support enabling that option for forks in organizations 🤦 If the edits you're looking to make are small, just let me know what they are and I'd be happy to go and make them. Alternatively, feel free to just cherry pick the changes here onto your own branch if that's easier. I'll remember to make a fork under my personal account the next time I need to contribute. Thanks! |
Then can you rebase this PR? |
Pressing |
Done! |
**Description:** Looks like the bug I ran into had nothing to do with the changes in #7856, since it's reproducible without it. Looks like it might have only surfaced now because #7853 changed the default value of `jsc.minify.format.comments`? Added a minimal test case here with the expected result. Here's the actual output: ```js export var padding = ''; export function exec2({ commands }) { return __awaiter(this, void 0, void 0, function*() { for(let i2 = 0; i2 < commands.length; i2++){ let command = commands[i2]; yield // some-comment function({ command }) { command(); }({ command, handleError }); } }); } ``` The comment ends up getting added after the yield, which makes the output invalid. Going to see if I can figure out a fix tomorrow, but let me know if you have any ideas on where to start looking in the meantime!
Description:
Hi there! I recently upgraded SWC from 1.3.60 to the latest 1.3.78 and discovered that some of my builds were broken because SWC's minifier was removing exports.
I've added some minimal repros of the cases I encountered as failing test cases, and a small change to the minifier to fix them.
Happy to iterate on this as you see fit. Cheers!