fix: no json-better-parser-error#20828
Conversation
|
|
This PR is packaged and the instant preview is available (a653ade). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@a653ade
yarn add -D webpack@https://pkg.pr.new/webpack@a653ade
pnpm add -D webpack@https://pkg.pr.new/webpack@a653ade |
Codecov Report❌ Patch coverage is
❌ Your changes status has failed because you have indirect coverage changes. Learn more about Unexpected Coverage Changes and reasons for indirect coverage changes. Additional details and impacted files@@ Coverage Diff @@
## main #20828 +/- ##
=======================================
Coverage 91.40% 91.40%
=======================================
Files 561 562 +1
Lines 55364 55402 +38
Branches 14604 14619 +15
=======================================
+ Hits 50605 50640 +35
- Misses 4759 4762 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR removes the direct dependency on json-parse-even-better-errors by introducing an internal parseJson utility and updating webpack internals and option typings to use it, with new unit tests to validate parsing and error formatting behavior.
Changes:
- Replace
json-parse-even-better-errorsusage in core modules withlib/util/parseJson. - Remove the direct dependency and related type/module declarations; update schema/type references to the new internal parse function type.
- Add unit tests covering parsing behavior (including BOM handling) and error message/metadata expectations.
Reviewed changes
Copilot reviewed 10 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/util/parseJson.js | New internal JSON parsing helper with enhanced error formatting. |
| lib/NormalModule.js | Switch loader-options JSON parsing to internal parseJson. |
| lib/json/JsonParser.js | Use internal parseJson as default JSON parser implementation. |
| lib/DllReferencePlugin.js | Switch manifest JSON parsing to internal parseJson and adjust imports. |
| lib/Compiler.js | Switch records JSON parsing to internal parseJson. |
| test/parseJson.unittest.js | Add unit tests for parseJson parsing + error behavior. |
| package.json | Remove direct dependency on json-parse-even-better-errors. |
| yarn.lock | Lockfile update reflecting dependency removal as a direct dependency. |
| declarations.d.ts | Remove module declaration for json-parse-even-better-errors. |
| schemas/WebpackOptions.json | Point JsonParserOptions.parse tsType to internal ParseJsonFn. |
| declarations/WebpackOptions.d.ts | Update JsonParserOptions.parse typing to internal ParseJsonFn. |
| types.d.ts | Update JsonParserOptions.parse typing and introduce ParseJsonFn interface. |
| .github/dependabot.yml | Stop excluding json-parse-even-better-errors from dependabot updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Summary
no
json-better-parser-error, using internal function, less outdated deps and fasterWhat kind of change does this PR introduce?
fix
Did you add tests for your changes?
Yes
Does this PR introduce a breaking change?
No
If relevant, what needs to be documented once your changes are merged or what have you already documented?
Nothing
Use of AI
No