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

webpack loaders: implement emitError and emitWarning #3983

Merged
merged 8 commits into from Mar 2, 2023

Conversation

wbinnssmith
Copy link
Member

This implements webpack loader context api for emitError and emitWarning, each of which emit Turbopack issues at the appropriate error level. As with webpack’s implementation, emitError does not cause builds to fail [0].

This uses next-dev issue snapshots (#3774) to test that issues are emitted.

[0] https://webpack.js.org/api/loaders/#thisemiterror

This implements webpack loader context api for `emitError` and `emitWarning`, each of which emit Turbopack issues at the appropriate error level. As with webpack’s implementation, `emitError` does _not_ cause builds to fail [0].

This uses next-dev issue snapshots (#3774) to test that issues are emitted.

[0] https://webpack.js.org/api/loaders/#thisemiterror
@vercel
Copy link

vercel bot commented Feb 27, 2023

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

Name Status Preview Comments Updated
examples-svelte-web 🔄 Building (Inspect) Mar 2, 2023 at 7:26PM (UTC)
9 Ignored Deployments
Name Status Preview Comments Updated
examples-basic-web ⬜️ Ignored (Inspect) Mar 2, 2023 at 7:26PM (UTC)
examples-cra-web ⬜️ Ignored (Inspect) Mar 2, 2023 at 7:26PM (UTC)
examples-designsystem-docs ⬜️ Ignored (Inspect) Mar 2, 2023 at 7:26PM (UTC)
examples-kitchensink-blog ⬜️ Ignored (Inspect) Mar 2, 2023 at 7:26PM (UTC)
examples-native-web ⬜️ Ignored (Inspect) Mar 2, 2023 at 7:26PM (UTC)
examples-nonmonorepo ⬜️ Ignored (Inspect) Mar 2, 2023 at 7:26PM (UTC)
examples-tailwind-web ⬜️ Ignored (Inspect) Mar 2, 2023 at 7:26PM (UTC)
examples-vite-web ⬜️ Ignored (Inspect) Mar 2, 2023 at 7:26PM (UTC)
turbo-site ⬜️ Ignored (Inspect) Visit Preview Mar 2, 2023 at 7:26PM (UTC)

@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2023

🟢 CI successful 🟢

Thanks

@github-actions
Copy link
Contributor

Benchmark for 7c2ca83

Test Base PR % Significant %
bench_hmr_to_commit/Turbopack SSR/1000 modules 11.43ms ± 0.37ms 12.47ms ± 0.09ms +9.08% +1.01%
bench_hmr_to_eval/Turbopack CSR/1000 modules 10.68ms ± 0.31ms 9528.02µs ± 41.02µs -10.82% -4.54%
bench_hmr_to_eval/Turbopack SSR/1000 modules 9781.24µs ± 150.88µs 10.84ms ± 0.33ms +10.80% +0.91%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 12.56ms ± 0.06ms 12.01ms ± 0.23ms -4.33%
bench_hmr_to_commit/Turbopack RCC/1000 modules 17.33ms ± 0.26ms 17.10ms ± 0.13ms -1.32%
bench_hmr_to_commit/Turbopack RSC/1000 modules 491.47ms ± 1.39ms 491.64ms ± 1.17ms +0.03%
bench_hmr_to_commit/Turbopack SSR/1000 modules 11.43ms ± 0.37ms 12.47ms ± 0.09ms +9.08% +1.01%
bench_hmr_to_eval/Turbopack CSR/1000 modules 10.68ms ± 0.31ms 9528.02µs ± 41.02µs -10.82% -4.54%
bench_hmr_to_eval/Turbopack RCC/1000 modules 15.69ms ± 0.17ms 15.84ms ± 0.11ms +0.97%
bench_hmr_to_eval/Turbopack SSR/1000 modules 9781.24µs ± 150.88µs 10.84ms ± 0.33ms +10.80% +0.91%
bench_hydration/Turbopack RCC/1000 modules 3809.16ms ± 8.15ms 3779.61ms ± 10.86ms -0.78%
bench_hydration/Turbopack RSC/1000 modules 3481.10ms ± 15.19ms 3462.92ms ± 13.67ms -0.52%
bench_hydration/Turbopack SSR/1000 modules 3338.61ms ± 9.49ms 3330.90ms ± 13.90ms -0.23%
bench_startup/Turbopack CSR/1000 modules 2528.74ms ± 5.85ms 2534.42ms ± 9.57ms +0.22%
bench_startup/Turbopack RCC/1000 modules 2317.17ms ± 9.45ms 2312.79ms ± 8.69ms -0.19%
bench_startup/Turbopack RSC/1000 modules 2259.37ms ± 10.44ms 2251.69ms ± 9.05ms -0.34%
bench_startup/Turbopack SSR/1000 modules 2030.98ms ± 3.08ms 2038.04ms ± 2.35ms +0.35%

crates/turbopack-node/js/src/ipc/evaluate.ts Outdated Show resolved Hide resolved
crates/turbopack-node/js/src/transforms/webpack-loaders.ts Outdated Show resolved Hide resolved
severity: severity,
error: {
name: error instanceof Error ? error.name : "Error",
message: error instanceof Error ? error.message : error,
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this is the bug here?

Suggested change
message: error instanceof Error ? error.message : error,
message: error instanceof Error ? error.message : String(error),

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2023

Benchmark for 99e1e93

Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 9896.73µs ± 230.30µs 9162.35µs ± 86.67µs -7.42% -1.06%
bench_hmr_to_commit/Turbopack SSR/1000 modules 10.23ms ± 0.21ms 9388.08µs ± 92.80µs -8.25% -2.40%
bench_hmr_to_eval/Turbopack CSR/1000 modules 8083.37µs ± 34.26µs 8989.00µs ± 138.30µs +11.20% +6.88%
bench_hydration/Turbopack RSC/1000 modules 3388.76ms ± 39.84ms 3252.82ms ± 11.85ms -4.01% -0.98%
bench_hydration/Turbopack SSR/1000 modules 3314.77ms ± 7.64ms 3462.50ms ± 29.75ms +4.46% +2.19%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 9896.73µs ± 230.30µs 9162.35µs ± 86.67µs -7.42% -1.06%
bench_hmr_to_commit/Turbopack RCC/1000 modules 13.96ms ± 0.09ms 13.49ms ± 0.34ms -3.36%
bench_hmr_to_commit/Turbopack RSC/1000 modules 506.38ms ± 1.57ms 514.94ms ± 8.73ms +1.69%
bench_hmr_to_commit/Turbopack SSR/1000 modules 10.23ms ± 0.21ms 9388.08µs ± 92.80µs -8.25% -2.40%
bench_hmr_to_eval/Turbopack CSR/1000 modules 8083.37µs ± 34.26µs 8989.00µs ± 138.30µs +11.20% +6.88%
bench_hmr_to_eval/Turbopack RCC/1000 modules 11.58ms ± 0.29ms 12.27ms ± 0.14ms +6.02%
bench_hmr_to_eval/Turbopack SSR/1000 modules 8289.20µs ± 164.27µs 8890.81µs ± 238.82µs +7.26%
bench_hydration/Turbopack RCC/1000 modules 3620.05ms ± 14.00ms 3681.81ms ± 33.13ms +1.71%
bench_hydration/Turbopack RSC/1000 modules 3388.76ms ± 39.84ms 3252.82ms ± 11.85ms -4.01% -0.98%
bench_hydration/Turbopack SSR/1000 modules 3314.77ms ± 7.64ms 3462.50ms ± 29.75ms +4.46% +2.19%
bench_startup/Turbopack CSR/1000 modules 2685.47ms ± 34.41ms 2731.31ms ± 30.47ms +1.71%
bench_startup/Turbopack RCC/1000 modules 2182.32ms ± 22.98ms 2134.61ms ± 6.46ms -2.19%
bench_startup/Turbopack RSC/1000 modules 2119.58ms ± 18.72ms 2189.18ms ± 23.21ms +3.28%
bench_startup/Turbopack SSR/1000 modules 2065.68ms ± 11.16ms 2050.68ms ± 2.40ms -0.73%

@wbinnssmith wbinnssmith merged commit 7747a13 into main Mar 2, 2023
@wbinnssmith wbinnssmith deleted the wbinnssmith/emit-warning-error branch March 2, 2023 21:59
jridgewell added a commit to vercel/next.js that referenced this pull request Mar 10, 2023
…o#3983)

This implements webpack loader context api for `emitError` and
`emitWarning`, each of which emit Turbopack issues at the appropriate
error level. As with webpack’s implementation, `emitError` does _not_
cause builds to fail [0].

This uses next-dev issue snapshots (vercel/turbo#3774) to test that issues are
emitted.

[0] https://webpack.js.org/api/loaders/#thisemiterror

---------

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
sokra pushed a commit to vercel/next.js that referenced this pull request Mar 13, 2023
…o#3983)

This implements webpack loader context api for `emitError` and
`emitWarning`, each of which emit Turbopack issues at the appropriate
error level. As with webpack’s implementation, `emitError` does _not_
cause builds to fail [0].

This uses next-dev issue snapshots (vercel/turbo#3774) to test that issues are
emitted.

[0] https://webpack.js.org/api/loaders/#thisemiterror

---------

Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
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.

None yet

2 participants