chore(package): remove sourcemaps from npm #907
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
v4 has 4 times larger file size than v3 (v4: 716kB, v3: 168kB, packagephobia). Although it does not affect the final bundle size of app's using this package, I think smaller is better for file disk usage and install times.
This is because of a) sourcemap is now published and b) ESM support which doubles the files.
This PR removes sourcemaps from npm by the same approach with inikulin/parse5#516.
This reduces the package size to 295 kB. (-58.8%)
Since this package uses typescript (that doesn't have ugly outputs) and doesn't run minify, I think the output is readable without sourcemaps and can be removed. Also it seems there are some problems with Webpack (#785).
This PR completely removes sourcemaps. But because most of the size is coming from
lib/generated/*.map
, an alternative approach is to remove only them. (I think these sourcemaps are not much important because it's a generated code.)This way the package size will be 328 kB.
diff for the alternative approach
files
field frompackage.json
.npmignore