Skip to content
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: cjs transfrom preset env #2503

Merged
merged 2 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/brave-pillows-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rspack/core": patch
---

fix: cjs transfrom preset env
4 changes: 2 additions & 2 deletions crates/rspack_plugin_javascript/src/visitors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pub fn run_before_pass(
}

let mut pass = chain!(
strict_mode(build_info, build_meta),
swc_visitor::resolver(unresolved_mark, top_level_mark, syntax.typescript()),
// swc_visitor::lint(
// &ast,
Expand Down Expand Up @@ -153,7 +154,6 @@ pub fn run_before_pass(
// The ordering of these two is important, `expr_simplifier` goes first and `dead_branch_remover` goes second.
swc_visitor::expr_simplifier(unresolved_mark, Default::default()),
swc_visitor::dead_branch_remover(unresolved_mark),
strict_mode(build_info, build_meta),
);
program.fold_with(&mut pass);

Expand Down Expand Up @@ -255,7 +255,7 @@ pub fn run_after_pass(
if build_meta.esm {
Some(ImportInterop::Swc)
} else {
None
Some(ImportInterop::None)
},
allow_top_level_this: true,
..Default::default()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
module.exports = {
target: ["node", "es5"]
target: ["node", "es5"],
builtins: {
presetEnv: {
targets: ["> 0.01%"]
}
}
};