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

WEB-1253: turbopack-cli: implement turbopack build #5488

Merged
merged 25 commits into from
Jul 20, 2023

Conversation

wbinnssmith
Copy link
Member

Depends on #5487

This implements a basic version of turbopack build, only targeting browser targets. In the future, we could accept a cli or configuration option to target Node.

Test Plan: cargo run -p turbopack-cli build with a src/index.js present and cargo run -p turbopack-cli build src/entry.js with src/entry.js present.

This work prepares for `turbopack build` by extracting code common between dev and build, such as asset context.

This also makes the cli accept a variadic list of entries rather than an unnamed directory parameter. The project directory is now available under `--dir` or `-d`.

Test Plan: `cargo run -p turbopack-cli dev` with a `src/index.js` present and `cargo run -p turbopack-cli dev src/entry.js` with `src/entry.js` present.
Depends on #5487

This implements a basic version of `turbopack build`, only targeting browser targets. In the future, we could accept a cli or configuration option to target Node.

Test Plan: `cargo run -p turbopack-cli build` with a `src/index.js` present and `cargo run -p turbopack-cli build src/entry.js` with `src/entry.js` present.
@wbinnssmith wbinnssmith requested a review from a team as a code owner July 10, 2023 20:31
@vercel
Copy link

vercel bot commented Jul 10, 2023

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

Name Status Preview Comments Updated (UTC)
examples-svelte-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jul 20, 2023 10:02pm
examples-vite-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jul 20, 2023 10:02pm
9 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Jul 20, 2023 10:02pm
examples-cra-web ⬜️ Ignored (Inspect) Visit Preview Jul 20, 2023 10:02pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Jul 20, 2023 10:02pm
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Jul 20, 2023 10:02pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Jul 20, 2023 10:02pm
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Jul 20, 2023 10:02pm
examples-nonmonorepo ⬜️ Ignored (Inspect) Visit Preview Jul 20, 2023 10:02pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Jul 20, 2023 10:02pm
turbo-site ⬜️ Ignored (Inspect) Visit Preview Jul 20, 2023 10:02pm

@github-actions
Copy link
Contributor

github-actions bot commented Jul 10, 2023

⚠️ This change may fail to build next-swc.

Logs

packages/next-swc/crates/next-build/src/next_build.rs:470:36: �[38;5;9merror[E0061]: this method takes 3 arguments but 2 arguments were supplied
error: could not compile `next-build` (lib) due to previous error

See job summary for details

@github-actions
Copy link
Contributor

github-actions bot commented Jul 10, 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 042dee2

Click to view benchmark
Test Base PR % Significant %

}))
.into();

handle_issues(build_result, issue_reporter, &None, &None).await?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we fail the build process if there are issues?

Comment on lines 283 to 289
for chunk_group in entry_chunk_groups {
for entry in &*chunk_group.await? {
for asset in &*all_assets_from_entry(entry.to_owned()).await? {
asset.content().write(asset.ident().path()).await?;
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

That's pretty inefficient since it's generating and writing all assets sequentially. You could generate and write them all in parallel.

@github-actions
Copy link
Contributor

Linux Benchmark for ac46a9c

Click to view benchmark
Test Base PR % Significant %

Base automatically changed from wbinnssmith/modularize-cli to main July 20, 2023 21:43
@github-actions
Copy link
Contributor

Linux Benchmark for 7da4e02

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 5441.07µs ± 10.29µs 5395.14µs ± 15.58µs -0.84%
bench_hmr_to_eval/Turbopack CSR/1000 modules 5024.85µs ± 18.74µs 5226.56µs ± 181.18µs +4.01%
bench_startup/Turbopack CSR/1000 modules 799.80ms ± 1.40ms 802.86ms ± 3.32ms +0.38%

@github-actions
Copy link
Contributor

MacOS Benchmark for 7da4e02

Test Base PR % Significant %
bench_startup/Turbopack CSR/1000 modules 9799.16ms ± 2776.71ms 3086.35ms ± 41.93ms -68.50% -25.33%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 27.47ms ± 0.09ms 27.48ms ± 0.06ms +0.03%
bench_hmr_to_eval/Turbopack CSR/1000 modules 26.45ms ± 0.09ms 25.71ms ± 0.39ms -2.78%
bench_startup/Turbopack CSR/1000 modules 9799.16ms ± 2776.71ms 3086.35ms ± 41.93ms -68.50% -25.33%

@wbinnssmith wbinnssmith merged commit 7bd1923 into main Jul 20, 2023
@wbinnssmith wbinnssmith deleted the wbinnssmith/turbopack-cli-build branch July 20, 2023 23:16
sokra added a commit to vercel/next.js that referenced this pull request Jul 21, 2023
* vercel/turborepo#5567 <!-- Alex Kirszenberg -
Remove unnecessary ValueDebugFormat item, hide Vc field -->
* vercel/turborepo#5576 <!-- Alex Kirszenberg -
Extract shared HMR utils to their own modules/crates -->
* vercel/turborepo#5503 <!-- OJ Kwon -
feat(turbopack_core): define trait for diagnostics -->
* vercel/turborepo#5487 <!-- Will Binns-Smith -
turbopack-cli: modularize code to support turbopack build -->
* vercel/turborepo#5488 <!-- Will Binns-Smith -
turbopack-cli: implement `turbopack build` -->
* vercel/turborepo#5450 <!-- Leah - feat: async
modules / top level await -->

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
@wbinnssmith wbinnssmith changed the title turbopack-cli: implement turbopack build WEB-1253: turbopack-cli: implement turbopack build Jul 21, 2023
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 25, 2024
Depends on vercel/turborepo#5487

This implements a basic version of `turbopack build`, only targeting
browser targets. In the future, we could accept a cli or configuration
option to target Node.

Test Plan: `cargo run -p turbopack-cli build` with a `src/index.js`
present and `cargo run -p turbopack-cli build src/entry.js` with
`src/entry.js` present.
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
Depends on vercel/turborepo#5487

This implements a basic version of `turbopack build`, only targeting
browser targets. In the future, we could accept a cli or configuration
option to target Node.

Test Plan: `cargo run -p turbopack-cli build` with a `src/index.js`
present and `cargo run -p turbopack-cli build src/entry.js` with
`src/entry.js` present.
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
Depends on vercel/turborepo#5487

This implements a basic version of `turbopack build`, only targeting
browser targets. In the future, we could accept a cli or configuration
option to target Node.

Test Plan: `cargo run -p turbopack-cli build` with a `src/index.js`
present and `cargo run -p turbopack-cli build src/entry.js` with
`src/entry.js` present.
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.

3 participants