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

feat(turbopack): Enable tree shaking for modules with dynamic imports #71692

Merged
merged 2 commits into from
Nov 18, 2024
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
6 changes: 3 additions & 3 deletions test/integration/telemetry/pages/warning.skip
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function a(v) {
return v
}
;['index.js'].forEach(async f => {
function a(v) {
return v
}
await import(a('./dynamic-file-imports/' + f))
})
kdy1 marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
10 changes: 0 additions & 10 deletions turbopack/crates/turbopack-ecmascript/src/tree_shake/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,16 +490,6 @@ impl Visit for ShouldSkip {
n.visit_children_with(self);
}

fn visit_callee(&mut self, n: &Callee) {
// TOOD(PACK-3231): Tree shaking work with dynamic imports
if matches!(n, Callee::Import(..)) {
self.skip = true;
return;
}

n.visit_children_with(self);
}

fn visit_expr(&mut self, n: &Expr) {
if self.skip {
return;
Expand Down
Loading