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 bug with imports field from a nested directory #5366

Merged
merged 1 commit into from
Jun 23, 2023

Conversation

jridgewell
Copy link
Contributor

Description

When importing a #foo subpath import, the resolved file is relative the the package.json containing the imports field, not the file with the import statement. This fixes subpath imports to use the proper context path during that resolve.

Testing Instructions

RUST_BACKTRACE=1 cargo nextest run -p turbopack-tests -E 'test(snapshot__imports__subpath_imports_nested)' --no-capture

Fixes WEB-1216

@jridgewell jridgewell requested a review from a team as a code owner June 23, 2023 02:53
@vercel
Copy link

vercel bot commented Jun 23, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-gatsby-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jun 23, 2023 6:36pm
examples-svelte-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jun 23, 2023 6:36pm
turbo-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 23, 2023 6:36pm
8 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Jun 23, 2023 6:36pm
examples-cra-web ⬜️ Ignored (Inspect) Visit Preview Jun 23, 2023 6:36pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Jun 23, 2023 6:36pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Jun 23, 2023 6:36pm
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Jun 23, 2023 6:36pm
examples-nonmonorepo ⬜️ Ignored (Inspect) Visit Preview Jun 23, 2023 6:36pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Jun 23, 2023 6:36pm
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Jun 23, 2023 6:36pm

@github-actions
Copy link
Contributor

github-actions bot commented Jun 23, 2023

✅ This change can build next-swc

@github-actions
Copy link
Contributor

Linux Benchmark for 2ecc672

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 7373.11µs ± 66.85µs 7282.15µs ± 69.16µs -1.23%
bench_hmr_to_eval/Turbopack CSR/1000 modules 6810.60µs ± 66.42µs 6856.14µs ± 182.15µs +0.67%
bench_startup/Turbopack CSR/1000 modules 940.41ms ± 2.25ms 935.48ms ± 3.46ms -0.52%

@github-actions
Copy link
Contributor

MacOS Benchmark for 2ecc672

Test Base PR % Significant %
bench_hmr_to_eval/Turbopack CSR/1000 modules 25.84ms ± 0.42ms 58.60ms ± 1.15ms +126.78% +111.02%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 26.39ms ± 0.12ms 26.40ms ± 0.16ms +0.03%
bench_hmr_to_eval/Turbopack CSR/1000 modules 25.84ms ± 0.42ms 58.60ms ± 1.15ms +126.78% +111.02%
bench_startup/Turbopack CSR/1000 modules 3380.62ms ± 28.71ms 3406.84ms ± 106.38ms +0.78%

@jridgewell jridgewell added the pr: automerge Kodiak will merge these automatically after checks pass label Jun 23, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 23, 2023

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Turbopack Rust tests (mac/win, non-blocking)

See workflow summary for details

@github-actions
Copy link
Contributor

Linux Benchmark for 510d869

Test Base PR % Significant %
bench_startup/Turbopack CSR/1000 modules 906.60ms ± 2.13ms 924.62ms ± 5.84ms +1.99% +0.23%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 6089.26µs ± 54.82µs 6072.81µs ± 23.48µs -0.27%
bench_hmr_to_eval/Turbopack CSR/1000 modules 5716.63µs ± 27.06µs 5957.54µs ± 150.38µs +4.21%
bench_startup/Turbopack CSR/1000 modules 906.60ms ± 2.13ms 924.62ms ± 5.84ms +1.99% +0.23%

@jridgewell jridgewell force-pushed the jrl-subpath-imports branch from 0abb53d to af09d65 Compare June 23, 2023 18:30
@kodiakhq kodiakhq bot merged commit a5ceec5 into main Jun 23, 2023
@kodiakhq kodiakhq bot deleted the jrl-subpath-imports branch June 23, 2023 18:53
@github-actions
Copy link
Contributor

Linux Benchmark for d934fbe

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 10.50ms ± 0.06ms 10.47ms ± 0.03ms -0.29%
bench_hmr_to_eval/Turbopack CSR/1000 modules 9876.89µs ± 194.22µs 9601.75µs ± 40.33µs -2.79%
bench_startup/Turbopack CSR/1000 modules 1096.12ms ± 1.34ms 1098.90ms ± 6.96ms +0.25%

@github-actions
Copy link
Contributor

MacOS Benchmark for d934fbe

Test Base PR % Significant %
bench_hmr_to_eval/Turbopack CSR/1000 modules 26.12ms ± 0.18ms 60.49ms ± 7.97ms +131.59% +68.27%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 26.87ms ± 0.18ms 26.55ms ± 0.23ms -1.16%
bench_hmr_to_eval/Turbopack CSR/1000 modules 26.12ms ± 0.18ms 60.49ms ± 7.97ms +131.59% +68.27%
bench_startup/Turbopack CSR/1000 modules 3496.10ms ± 107.87ms 3441.09ms ± 101.46ms -1.57%

sokra added a commit to vercel/next.js that referenced this pull request Jun 29, 2023
Reverts #51940

### What?

Update SWC crates and turbopack

### Turbopack Updates

* vercel/turborepo#5366 <!-- Justin Ridgewell - Fix
bug with `imports` field from a nested directory -->
* vercel/turborepo#5361 <!-- Tobias Koppers - update
for next.js changes to env vars -->
* vercel/turborepo#5311 <!-- OJ Kwon -
test(filetrace): skip failing tests -->
* vercel/turborepo#5402 <!-- Leah - reduce indent in
`analyze_ecmascript_module` by splitting the function up -->
* vercel/turborepo#5412 <!-- Leah - Update
`swc_core` to `v0.78.24` -->

Closes WEB-1174

Turbopack counterpart: vercel/turborepo#5412

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 25, 2024
…o#5366)

### Description

When importing a `#foo` subpath import, the resolved file is relative
the the `package.json` containing the `imports` field, not the file with
the import statement. This fixes subpath imports to use the proper
context path during that resolve.

### Testing Instructions

```
RUST_BACKTRACE=1 cargo nextest run -p turbopack-tests -E 'test(snapshot__imports__subpath_imports_nested)' --no-capture
```

Fixes WEB-1216
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
…o#5366)

### Description

When importing a `#foo` subpath import, the resolved file is relative
the the `package.json` containing the `imports` field, not the file with
the import statement. This fixes subpath imports to use the proper
context path during that resolve.

### Testing Instructions

```
RUST_BACKTRACE=1 cargo nextest run -p turbopack-tests -E 'test(snapshot__imports__subpath_imports_nested)' --no-capture
```

Fixes WEB-1216
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
…o#5366)

### Description

When importing a `#foo` subpath import, the resolved file is relative
the the `package.json` containing the `imports` field, not the file with
the import statement. This fixes subpath imports to use the proper
context path during that resolve.

### Testing Instructions

```
RUST_BACKTRACE=1 cargo nextest run -p turbopack-tests -E 'test(snapshot__imports__subpath_imports_nested)' --no-capture
```

Fixes WEB-1216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: automerge Kodiak will merge these automatically after checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants