-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Minify globals.json
#198
Comments
The |
I guess the ideal course of action would be a |
Lines 13 to 15 in d887e4c
In a rare exception, this package supports node 8 and up, so it's incompatible with ESM imports between Node 12 and Node 16 (where ESM is supported, but |
You don't need a import assertion to import a module with a |
That's not true. Also this request is off-topic so I'll stop here. https://unpkg.com/browse/test-test-test-json-import-will-delete-this-package@0.0.0/package.json {
"name": "test-test-test-json-import-will-delete-this-package",
"version": "0.0.0",
"exports": "./package.json"
} // index.mjs
import x from 'test-test-test-json-import-will-delete-this-package';
console.log(x);
|
Interesting, likely I wasn't aware of this as I import all my json modules in a bundler and/or typscript which supports json without assertion. So yes, converting this module to json would be a breaking change for node users. |
We could make this package a lot smaller by minifying the
globals.json
file. Considering that this package is downloaded 53 million (!) times a week (according to NPM), making it as small as possible will save bandwidth and storage.To start, here is the size of the package based off the
main
branch (only including the relevant lines):Simply by stripping white space, newlines, etc., from the JSON file we can decrease the file size by ~7.1KB:
This is good, but we can do better! If we replace
true
andfalse
with1
and0
respectively we can reduce the file size even further:This last method will require that we change the
index.js
file to convert1
and0
withtrue
andfalse
to maintain backwards compatibility, which might be more trouble than it is worth.I don't know what the deployment process for this project looks like (I don't see any GitHub Action workflows or anything), but I might suggest that, at the very least, the
globals.json
file be minified before publishing. I would be willing to open a PR for the second method if we decide it would be worth it.This issue also could be applicable to the
builtin-modules
package as well.Thanks!
The text was updated successfully, but these errors were encountered: