Skip to content

perf(core): remove json-parse-even-better-errors dependency#10122

Merged
chenjiahan merged 2 commits intomainfrom
remove_json_parse_dep_0422
Apr 22, 2025
Merged

perf(core): remove json-parse-even-better-errors dependency#10122
chenjiahan merged 2 commits intomainfrom
remove_json_parse_dep_0422

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

@chenjiahan chenjiahan commented Apr 22, 2025

Summary

This PR removes the json-parse-even-better-errors dependency to remove ~100 loc from the dist/index.js.

I think this package can be removed due to two reasons:

  1. The "loader string option parsing error" is a rare case, and I think few users will encounter this error.
  2. json-parse-even-better-errors does not seem to improve the readability of the error, but makes the log more complicated:
import jsonParse from "json-parse-even-better-errors";

const invalidJson = "{foo:1,bar:2,baz:`}";

try {
  console.log("=== JSON.parse ===");
  JSON.parse(invalidJson);
} catch (e) {
  console.log(e);
  console.log('\n');
}

try {
  console.log("=== json-parse-even-better-errors ===");
  jsonParse(invalidJson);
} catch (e) {
  console.log(e);
}

image

Checklist

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

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 22, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit af76953
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/68075f595ffea2000802b51c

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

codspeed-hq bot commented Apr 22, 2025

CodSpeed Performance Report

Merging #10122 will not alter performance

Comparing remove_json_parse_dep_0422 (af76953) with main (33eeb76)

Summary

✅ 11 untouched benchmarks

@chenjiahan chenjiahan requested a review from h-a-n-a April 22, 2025 09:51
Copy link
Copy Markdown
Contributor

@h-a-n-a h-a-n-a left a comment

Choose a reason for hiding this comment

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

Looks removable

@chenjiahan chenjiahan merged commit bc2928d into main Apr 22, 2025
33 of 34 checks passed
@chenjiahan chenjiahan deleted the remove_json_parse_dep_0422 branch April 22, 2025 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: performance release: performance 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.

2 participants