Skip to content

Conversation

@h-a-n-a
Copy link
Contributor

@h-a-n-a h-a-n-a commented Apr 16, 2025

Summary

This PR supports StatsError.code and StatsWarning.code. This is an rspack-specific API, which is not implemented in webpack. StatsErrorCode is exported as a reference to code used in rspack.

  • ChunkMinificationError: Generated when chunk minification encounters an error
  • ChunkMinificationWarning: Generated when chunk minification encounters an warning
  • ModuleParseWarning: Generated when module parsing encounters an warning
  • ModuleParseError: Generated when module parsing encounters an error
  • ModuleBuildError: Generated when module loader encounters an error

The following example shows when minifcation encounters an error:

ERROR in main.js
  × Chunk minification failed:
  ╰─▶   × JavaScript parse error: 'import', and 'export' cannot be used outside of module code
          ╭─[8:0]
        6 │   \******************/
        7 │ (function (module, exports) {
        8 │ import "./abc";
          · ──────
        9 │
       10 │
          ╰────

Its error code is ChunkMinificationError.

trivial changes: Normalize parsing error into parse error. This follows webpack's naming convention, e.g ModuleParseError.

Note: There are a few snapshot changes due to a few newly added snapshot serializer.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions bot added team The issue/pr is created by the member of Rspack. release: feature release: feature related release(mr only) labels Apr 16, 2025
@netlify
Copy link

netlify bot commented Apr 16, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit cb515c1
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6836f1472cea090008dd8cff

hardfist
hardfist previously approved these changes Apr 16, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Apr 16, 2025

CodSpeed Performance Report

Merging #10057 will not alter performance

Comparing minification-error (cb515c1) with main (b06187c)

🎉 Hooray! codspeed-node just leveled up to 4.0.1!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

Summary

✅ 11 untouched benchmarks

@h-a-n-a h-a-n-a force-pushed the minification-error branch 7 times, most recently from 4a62b0b to 2fdf384 Compare April 22, 2025 10:53
@h-a-n-a h-a-n-a marked this pull request as ready for review April 22, 2025 11:58
@h-a-n-a h-a-n-a requested a review from LingyuCoder as a code owner April 22, 2025 11:58
@h-a-n-a h-a-n-a enabled auto-merge (squash) April 22, 2025 11:58
chenjiahan
chenjiahan previously approved these changes Apr 23, 2025
@h-a-n-a
Copy link
Contributor Author

h-a-n-a commented Apr 23, 2025

Holding off on this PR until it's fully discussed.

@h-a-n-a h-a-n-a force-pushed the minification-error branch from 2fdf384 to d725078 Compare May 28, 2025 09:28
@h-a-n-a h-a-n-a force-pushed the minification-error branch 2 times, most recently from d1cd205 to 7c80a27 Compare May 28, 2025 10:54
@h-a-n-a h-a-n-a force-pushed the minification-error branch from 7c80a27 to cb515c1 Compare May 28, 2025 11:19
@h-a-n-a h-a-n-a removed the on hold label May 28, 2025
@h-a-n-a
Copy link
Contributor Author

h-a-n-a commented May 28, 2025

Rebased cc @chenjiahan

@h-a-n-a h-a-n-a requested a review from chenjiahan May 28, 2025 11:30
@h-a-n-a h-a-n-a merged commit 41ecb0e into main May 28, 2025
35 checks passed
@h-a-n-a h-a-n-a deleted the minification-error branch May 28, 2025 12:52
@chenjiahan
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants