Skip to content

Commit d3bc037

Browse files
authored
Turbopack: don't match dynamic pattern for node_modules packages (#83176)
This code would previously pull in every single package in node_modules ``` var path = require("path"); var dir = foo; if (bar) { dir = process.cwd(); } path.join(dir, "node_modules"); ``` Now, `node_modules/<dynamic>` doesn't match every single package anymore. It effectively thinks that `node_modules` is an empty folder when enumerating it.
1 parent e657c38 commit d3bc037

File tree

12 files changed

+229
-62
lines changed

12 files changed

+229
-62
lines changed

turbopack/crates/turbopack-core/src/resolve/pattern.rs

Lines changed: 188 additions & 27 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!**

turbopack/crates/turbopack-core/tests/pattern/read_matches/index.js

Whitespace-only changes.

turbopack/crates/turbopack-core/tests/pattern/read_matches/node_modules/pkg/LICENSE

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

turbopack/crates/turbopack-core/tests/pattern/read_matches/node_modules/pkg/README.md

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

turbopack/crates/turbopack-core/tests/pattern/read_matches/node_modules/pkg/index.js

Whitespace-only changes.

turbopack/crates/turbopack-core/tests/pattern/read_matches/node_modules/pkg/package.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

turbopack/crates/turbopack-core/tests/pattern/read_matches/sub/foo-a.js

Whitespace-only changes.

turbopack/crates/turbopack-core/tests/pattern/read_matches/sub/foo-a.js.map

Whitespace-only changes.

turbopack/crates/turbopack-core/tests/pattern/read_matches/sub/foo-b.js

Whitespace-only changes.

0 commit comments

Comments
 (0)