-
-
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
feat(es/module): Preserve custom use
directives
#7528
Conversation
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.
swc-bump:
- swc_ecma_utils
use
directives
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.
Automated review comment generated by auto-rebase script
**Related issue:** - Closes #7315.
if self.config.strict_mode { | ||
stmts.push(clone_first_use_strict(n).unwrap_or_else(use_strict)); | ||
stmts.push(clone_first_use_directive(n).unwrap_or_else(use_strict)); | ||
} |
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.
Maybe I'm not understanding what this is doing, but at first glance, does this mean that if an input file has a directive, it would only get hoisted to the top of the file if strictMode
is enabled? I'm using strict mode, so it doesn't really affect me, but I imagine this would be a bug that may present itself in the future.
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.
I guess I must be mis-understanding. I just finished upgrading and tried it out setting strictMode to false and the directive still makes its way to the top. So you can ignore me...it is working as it should.
Description:
Related issue: