这是indexloc提供的服务,不要输入任何密码
Skip to content

Apply the next/dynamic SWC transform #3184

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

Merged
merged 6 commits into from
Jan 13, 2023

Conversation

alexkirsz
Copy link
Contributor

@alexkirsz alexkirsz commented Jan 5, 2023

This PR adds the next/dynamic SWC transform to the repo. This is copied over from the implementation in , with an additional mode for Turbopack.

For now, it applies it to all sources files (excluding node_modules, but including embedded modules).

I've refactored the Next transforms logic to make it more easily extendable in the future, and avoid creating more Vcs than absolutely necessary.

This PR is the last item in the list of what's needed to support next/dynamic in development.

@alexkirsz alexkirsz requested a review from a team as a code owner January 5, 2023 13:03
@vercel
Copy link

vercel bot commented Jan 5, 2023

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

Name Status Preview Comments Updated
examples-kitchensink-blog 🔄 Building (Inspect) Jan 13, 2023 at 0:54AM (UTC)
examples-nonmonorepo 🔄 Building (Inspect) Jan 13, 2023 at 0:54AM (UTC)
8 Ignored Deployments
Name Status Preview Comments Updated
examples-basic-web ⬜️ Ignored (Inspect) Jan 13, 2023 at 0:54AM (UTC)
examples-cra-web ⬜️ Ignored (Inspect) Jan 13, 2023 at 0:54AM (UTC)
examples-designsystem-docs ⬜️ Ignored (Inspect) Jan 13, 2023 at 0:54AM (UTC)
examples-native-web ⬜️ Ignored (Inspect) Jan 13, 2023 at 0:54AM (UTC)
examples-svelte-web ⬜️ Ignored (Inspect) Jan 13, 2023 at 0:54AM (UTC)
examples-tailwind-web ⬜️ Ignored (Inspect) Jan 13, 2023 at 0:54AM (UTC)
turbo-site ⬜️ Ignored (Inspect) Visit Preview Jan 13, 2023 at 0:54AM (UTC)
turbo-vite-web ⬜️ Ignored (Inspect) Jan 13, 2023 at 0:54AM (UTC)

@alexkirsz
Copy link
Contributor Author

alexkirsz commented Jan 5, 2023

@alexkirsz alexkirsz force-pushed the alexkirsz/web-375-apply-the-nextdynamic-swc-transform branch from 0cf606b to a661cdd Compare January 5, 2023 14:39
@alexkirsz alexkirsz force-pushed the alexkirsz/web-374-re-organize-next_client-and-next_server branch from ccfa77b to 9f0b183 Compare January 6, 2023 09:14
@alexkirsz alexkirsz force-pushed the alexkirsz/web-375-apply-the-nextdynamic-swc-transform branch from a661cdd to 468260f Compare January 6, 2023 09:14
Base automatically changed from alexkirsz/web-374-re-organize-next_client-and-next_server to main January 6, 2023 10:36
@alexkirsz alexkirsz force-pushed the alexkirsz/web-375-apply-the-nextdynamic-swc-transform branch from 468260f to a4c98cd Compare January 9, 2023 12:36
@alexkirsz alexkirsz requested a review from a team as a code owner January 9, 2023 12:36
@alexkirsz alexkirsz force-pushed the alexkirsz/web-375-apply-the-nextdynamic-swc-transform branch from a4c98cd to 44ca034 Compare January 9, 2023 13:12
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2023

Benchmark for d03a2c0

Test Base PR % Significant %
bench_hydration/Turbopack RSC/1000 modules 2855.05ms ± 7.57ms 2889.29ms ± 7.54ms +1.20% +0.14%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 8700.77µs ± 67.83µs 8768.62µs ± 48.84µs +0.78%
bench_hmr_to_commit/Turbopack RCC/1000 modules 8980.98µs ± 78.60µs 9061.76µs ± 89.58µs +0.90%
bench_hmr_to_commit/Turbopack RSC/1000 modules 480.97ms ± 2.67ms 480.25ms ± 1.09ms -0.15%
bench_hmr_to_commit/Turbopack SSR/1000 modules 8816.42µs ± 66.86µs 8894.43µs ± 94.36µs +0.88%
bench_hmr_to_eval/Turbopack CSR/1000 modules 7692.23µs ± 62.22µs 7669.05µs ± 64.08µs -0.30%
bench_hmr_to_eval/Turbopack RCC/1000 modules 7829.75µs ± 62.91µs 7924.56µs ± 58.74µs +1.21%
bench_hmr_to_eval/Turbopack SSR/1000 modules 7748.53µs ± 53.34µs 7806.82µs ± 31.42µs +0.75%
bench_hydration/Turbopack RCC/1000 modules 3387.72ms ± 15.18ms 3413.80ms ± 9.13ms +0.77%
bench_hydration/Turbopack RSC/1000 modules 2855.05ms ± 7.57ms 2889.29ms ± 7.54ms +1.20% +0.14%
bench_hydration/Turbopack SSR/1000 modules 2669.57ms ± 14.35ms 2702.35ms ± 9.84ms +1.23%
bench_startup/Turbopack CSR/1000 modules 1662.26ms ± 3.31ms 1665.86ms ± 4.33ms +0.22%
bench_startup/Turbopack RCC/1000 modules 2544.50ms ± 12.00ms 2585.79ms ± 13.32ms +1.62%
bench_startup/Turbopack RSC/1000 modules 2466.94ms ± 7.87ms 2453.46ms ± 5.08ms -0.55%
bench_startup/Turbopack SSR/1000 modules 2092.95ms ± 6.16ms 2097.68ms ± 5.22ms +0.23%

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2023

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Rust tests
  • Node.js lints

See workflow summary for details

@alexkirsz alexkirsz changed the base branch from main to alexkirsz/web-378-add-support-for-dynamic-imports-on-the January 10, 2023 16:16
@alexkirsz alexkirsz force-pushed the alexkirsz/web-375-apply-the-nextdynamic-swc-transform branch from 44ca034 to c9f8a3f Compare January 10, 2023 16:16
@alexkirsz alexkirsz changed the title Apply the next/dynamic SWC transform [Draft] Apply the next/dynamic SWC transform Jan 10, 2023
@alexkirsz alexkirsz force-pushed the alexkirsz/web-375-apply-the-nextdynamic-swc-transform branch from c9f8a3f to 0131667 Compare January 11, 2023 12:39
@alexkirsz alexkirsz force-pushed the alexkirsz/web-375-apply-the-nextdynamic-swc-transform branch 2 times, most recently from 19480dc to 183d30f Compare January 12, 2023 13:33
Base automatically changed from alexkirsz/web-378-add-support-for-dynamic-imports-on-the to main January 12, 2023 15:37
@alexkirsz alexkirsz force-pushed the alexkirsz/web-375-apply-the-nextdynamic-swc-transform branch from 58a14a7 to 573320f Compare January 12, 2023 17:22
@github-actions
Copy link
Contributor

Benchmark for a38d458

Test Base PR % Significant %
bench_startup/Turbopack RSC/1000 modules 2491.85ms ± 7.98ms 2630.53ms ± 16.62ms +5.57% +3.57%
bench_startup/Turbopack SSR/1000 modules 2171.93ms ± 10.46ms 2125.69ms ± 5.71ms -2.13% -0.65%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 8754.49µs ± 79.78µs 8703.68µs ± 57.49µs -0.58%
bench_hmr_to_commit/Turbopack RCC/1000 modules 8879.92µs ± 59.69µs 8895.44µs ± 50.10µs +0.17%
bench_hmr_to_commit/Turbopack RSC/1000 modules 502.16ms ± 3.29ms 498.59ms ± 2.53ms -0.71%
bench_hmr_to_commit/Turbopack SSR/1000 modules 8728.21µs ± 35.46µs 8872.85µs ± 61.66µs +1.66%
bench_hmr_to_eval/Turbopack CSR/1000 modules 7766.83µs ± 90.50µs 7745.62µs ± 75.57µs -0.27%
bench_hmr_to_eval/Turbopack RCC/1000 modules 7839.81µs ± 91.15µs 7900.03µs ± 64.37µs +0.77%
bench_hmr_to_eval/Turbopack SSR/1000 modules 7735.65µs ± 38.18µs 7813.95µs ± 55.92µs +1.01%
bench_hydration/Turbopack RCC/1000 modules 3475.52ms ± 16.07ms 3474.39ms ± 9.78ms -0.03%
bench_hydration/Turbopack RSC/1000 modules 2986.13ms ± 16.59ms 2938.12ms ± 9.03ms -1.61%
bench_hydration/Turbopack SSR/1000 modules 2751.53ms ± 8.66ms 2738.67ms ± 8.33ms -0.47%
bench_startup/Turbopack CSR/1000 modules 1692.62ms ± 6.86ms 1705.05ms ± 4.84ms +0.73%
bench_startup/Turbopack RCC/1000 modules 2643.17ms ± 19.34ms 2592.93ms ± 11.38ms -1.90%
bench_startup/Turbopack RSC/1000 modules 2491.85ms ± 7.98ms 2630.53ms ± 16.62ms +5.57% +3.57%
bench_startup/Turbopack SSR/1000 modules 2171.93ms ± 10.46ms 2125.69ms ± 5.71ms -2.13% -0.65%

@alexkirsz alexkirsz force-pushed the alexkirsz/web-375-apply-the-nextdynamic-swc-transform branch from 573320f to dc7bedf Compare January 13, 2023 10:25
@alexkirsz alexkirsz requested a review from sokra January 13, 2023 10:30
@github-actions
Copy link
Contributor

Benchmark for 2ff13af

Test Base PR % Significant %
bench_hydration/Turbopack RCC/1000 modules 3393.12ms ± 8.65ms 3461.10ms ± 10.03ms +2.00% +0.90%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 8712.85µs ± 72.56µs 8721.13µs ± 44.81µs +0.10%
bench_hmr_to_commit/Turbopack RCC/1000 modules 8878.43µs ± 64.70µs 8977.22µs ± 57.69µs +1.11%
bench_hmr_to_commit/Turbopack RSC/1000 modules 482.84ms ± 2.92ms 489.08ms ± 1.34ms +1.29%
bench_hmr_to_commit/Turbopack SSR/1000 modules 8739.55µs ± 54.64µs 8812.10µs ± 52.17µs +0.83%
bench_hmr_to_eval/Turbopack CSR/1000 modules 7637.68µs ± 75.03µs 7706.81µs ± 54.23µs +0.91%
bench_hmr_to_eval/Turbopack RCC/1000 modules 7751.63µs ± 51.53µs 7846.22µs ± 59.12µs +1.22%
bench_hmr_to_eval/Turbopack SSR/1000 modules 7727.64µs ± 131.30µs 7788.55µs ± 99.85µs +0.79%
bench_hydration/Turbopack RCC/1000 modules 3393.12ms ± 8.65ms 3461.10ms ± 10.03ms +2.00% +0.90%
bench_hydration/Turbopack RSC/1000 modules 2894.82ms ± 7.70ms 2907.39ms ± 6.76ms +0.43%
bench_hydration/Turbopack SSR/1000 modules 2709.78ms ± 6.75ms 2689.72ms ± 8.21ms -0.74%
bench_startup/Turbopack CSR/1000 modules 1680.99ms ± 2.98ms 1677.35ms ± 5.39ms -0.22%
bench_startup/Turbopack RCC/1000 modules 2578.88ms ± 11.34ms 2575.44ms ± 7.30ms -0.13%
bench_startup/Turbopack RSC/1000 modules 2451.78ms ± 10.78ms 2468.88ms ± 10.03ms +0.70%
bench_startup/Turbopack SSR/1000 modules 2087.34ms ± 6.33ms 2089.50ms ± 3.97ms +0.10%

Copy link
Member

@sokra sokra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably fine

A test for that that actually runs the code would be great: next-dev/tests

@alexkirsz alexkirsz merged commit f1e9e48 into main Jan 13, 2023
@alexkirsz alexkirsz deleted the alexkirsz/web-375-apply-the-nextdynamic-swc-transform branch January 13, 2023 13:18
@github-actions
Copy link
Contributor

Benchmark for cd38f3b

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 8593.13µs ± 69.00µs 8663.36µs ± 61.95µs +0.82%
bench_hmr_to_commit/Turbopack RCC/1000 modules 8900.52µs ± 61.50µs 8871.69µs ± 68.34µs -0.32%
bench_hmr_to_commit/Turbopack RSC/1000 modules 474.46ms ± 2.85ms 476.89ms ± 1.95ms +0.51%
bench_hmr_to_commit/Turbopack SSR/1000 modules 8658.80µs ± 63.82µs 8656.21µs ± 74.89µs -0.03%
bench_hmr_to_eval/Turbopack CSR/1000 modules 7591.45µs ± 68.46µs 7613.55µs ± 55.84µs +0.29%
bench_hmr_to_eval/Turbopack RCC/1000 modules 7746.32µs ± 55.30µs 7700.82µs ± 62.76µs -0.59%
bench_hmr_to_eval/Turbopack SSR/1000 modules 7661.30µs ± 81.41µs 7670.70µs ± 71.18µs +0.12%
bench_hydration/Turbopack RCC/1000 modules 3380.97ms ± 12.00ms 3371.07ms ± 13.59ms -0.29%
bench_hydration/Turbopack RSC/1000 modules 2876.24ms ± 10.23ms 2867.77ms ± 7.81ms -0.29%
bench_hydration/Turbopack SSR/1000 modules 2647.38ms ± 10.05ms 2682.63ms ± 7.88ms +1.33%
bench_startup/Turbopack CSR/1000 modules 1655.23ms ± 6.67ms 1664.87ms ± 4.74ms +0.58%
bench_startup/Turbopack RCC/1000 modules 2528.64ms ± 7.60ms 2536.77ms ± 8.61ms +0.32%
bench_startup/Turbopack RSC/1000 modules 2401.76ms ± 5.89ms 2402.97ms ± 9.01ms +0.05%
bench_startup/Turbopack SSR/1000 modules 2055.51ms ± 5.19ms 2049.65ms ± 3.76ms -0.28%

jridgewell pushed a commit to vercel/next.js that referenced this pull request Mar 10, 2023
This PR adds the next/dynamic SWC transform to the repo. This is copied
over from the implementation in
[](https://github.com/vercel/next.js/blob/3e2e39c55939bd156cbb4dab926aaaa126b53d1c/packages/next-swc/crates/core/src/next_dynamic.rs),
with an additional mode for Turbopack.

For now, it applies it to all sources files (excluding node_modules, but
including embedded modules).

I've refactored the Next transforms logic to make it more easily
extendable in the future, and avoid creating more Vcs than absolutely
necessary.

This PR is the last item in the list of what's needed to support
next/dynamic in development.
sokra pushed a commit to vercel/next.js that referenced this pull request Mar 13, 2023
This PR adds the next/dynamic SWC transform to the repo. This is copied
over from the implementation in
[](https://github.com/vercel/next.js/blob/f70a6bfb8635929feeecc92413da1fb2b651a18d/packages/next-swc/crates/core/src/next_dynamic.rs),
with an additional mode for Turbopack.

For now, it applies it to all sources files (excluding node_modules, but
including embedded modules).

I've refactored the Next transforms logic to make it more easily
extendable in the future, and avoid creating more Vcs than absolutely
necessary.

This PR is the last item in the list of what's needed to support
next/dynamic in development.
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 25, 2024
This PR adds the next/dynamic SWC transform to the repo. This is copied
over from the implementation in
[](https://github.com/vercel/next.js/blob/3e2e39c55939bd156cbb4dab926aaaa126b53d1c/packages/next-swc/crates/core/src/next_dynamic.rs),
with an additional mode for Turbopack.

For now, it applies it to all sources files (excluding node_modules, but
including embedded modules).

I've refactored the Next transforms logic to make it more easily
extendable in the future, and avoid creating more Vcs than absolutely
necessary.

This PR is the last item in the list of what's needed to support
next/dynamic in development.
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
This PR adds the next/dynamic SWC transform to the repo. This is copied
over from the implementation in
[](https://github.com/vercel/next.js/blob/3e2e39c55939bd156cbb4dab926aaaa126b53d1c/packages/next-swc/crates/core/src/next_dynamic.rs),
with an additional mode for Turbopack.

For now, it applies it to all sources files (excluding node_modules, but
including embedded modules).

I've refactored the Next transforms logic to make it more easily
extendable in the future, and avoid creating more Vcs than absolutely
necessary.

This PR is the last item in the list of what's needed to support
next/dynamic in development.
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
This PR adds the next/dynamic SWC transform to the repo. This is copied
over from the implementation in
[](https://github.com/vercel/next.js/blob/3e2e39c55939bd156cbb4dab926aaaa126b53d1c/packages/next-swc/crates/core/src/next_dynamic.rs),
with an additional mode for Turbopack.

For now, it applies it to all sources files (excluding node_modules, but
including embedded modules).

I've refactored the Next transforms logic to make it more easily
extendable in the future, and avoid creating more Vcs than absolutely
necessary.

This PR is the last item in the list of what's needed to support
next/dynamic in development.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants