-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Preserve correct this
for named/default imports
#7956
Conversation
b18670d
to
67bfa06
Compare
Expr::Ident(ident) => { | ||
if let Some(Import { specifier, .. }) = self.collect.imports.get(&id!(ident)) { | ||
if specifier != "*" { | ||
return Expr::Seq(SeqExpr { | ||
span: ident.span, | ||
exprs: vec![0.into(), Box::new(Expr::Ident(ident.fold_with(self)))], | ||
}); | ||
} | ||
} | ||
return Expr::Ident(ident.fold_with(self)); | ||
} |
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.
A cleaner fix (and what I tried to do first) was to move the fold_ident
function into this match. But fold_ident
runs not only referenced identifiers (=Expr::Ident
) but also the names of function/variable declarations.
I'm not sure if it would make sense to split up fold_ident/extract the parts we need and use them here directly instead.
Benchmark ResultsKitchen Sink 🚨
Timings
Cold BundlesNo bundles found, this is probably a failed build... Cached BundlesNo bundles found, this is probably a failed build... React HackerNews ✅
Timings
Cold Bundles
Cached Bundles
AtlasKit Editor 🚨
Timings
Cold BundlesNo bundles found, this is probably a failed build... Cached BundlesNo bundles found, this is probably a failed build... Three.js ✅
Timings
Cold Bundles
Cached Bundles
|
Looks like a bunch of tests are failing |
d5224fd
to
7b1b9c2
Compare
Benchmark ResultsKitchen Sink 🚨
Timings
Cold BundlesNo bundles found, this is probably a failed build... Cached BundlesNo bundles found, this is probably a failed build... React HackerNews ✅
Timings
Cold Bundles
Cached Bundles
AtlasKit Editor 🚨
Timings
Cold BundlesNo bundles found, this is probably a failed build... Cached BundlesNo bundles found, this is probably a failed build... Three.js ✅
Timings
Cold Bundles
Cached Bundles
|
Because of nodejs/node#38918... I'll probably have to change the fixtures to do |
ba379a6
to
60cc6ec
Compare
I've removed the change to insert use strict in the packager and instead simply tell |
Closes #7920
Wraps references to named/default imports with
(0, id)
like swc/Babel does, so the output is:Problems
"use strict"
to make the test pass. (For thethis === ns
check).module.exports
): Fix wrapped assets importing their own namespace #7978