-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Optimize the npm package size #6105
Conversation
Explicitly target files that should be included in the npm package, which make the npm package 8x smaller by removing the docs, samples, scripts, tests and other useless files.
I'm realizing that since #6048, it's not possible anymore for an external node project to import files directly from So we should either (1) remove the rollup step and duplicate the CSS code in the .js file, which would allow npm consumers to include our source files but also means we should not switch to ES6 imports until v3, or (2) remove the Not sure what solution (1) or (2) will be preferred by our users, neither if (2) would break any integrations? |
You mentioned a few files in your comment that weren't whitelisted in the PR. I guess those get pulled in automatically?
It might be nice to copy |
Right (npm docs):
That's already the case, the build process generates |
I also prefer solution (2) because I don't think users should use our source files directly, but unfortunately, I can find a few cases where it's promoted to import |
I like 2, but it's definitely breaking |
Though, it doesn't seem to work (valor-software/ng2-charts#1041) so maybe we shouldn't try to support importing from our If we really care to not break these projects that import // src/chart.js
module.exports = require('../dist/Chart.js'); It would only break projects that require other files (e.g. |
I like option 2 too. Maybe it should be include for compatibility for now and instruct people to import from dist? |
I consider accessing |
I think we should do the rc with this, and see if anything needs to be changes? |
I agree with @benmccann, so instead, should we go for (2) (remove |
I removed the sources from the npm package I think the alias is useless for
|
If you do esm, ng2 charts will be properly updated |
ng2-charts doesn't actually have a dependency on charts.js file, only docs has (the line you have pointed) |
@valorkin it could be a good idea to update the documentation ( |
Explicitly target files that should be included in the npm package, making it 10x smaller by removing the docs, samples, scripts, sources, tests and other useless files.
Explicitly target files that should be included in the npm package:
The following files will be removed:
I don't think anyone read the docs or browse samples from the
node_modes/chart.js
directory but instead access our website and/or GH projet. Removing these resources is not a breaking change so if someone complain about these missing files, we can still decide or not to re-introduce part of them.Please review carefully files included in 2.7.3 and tell me if you think we should include something else.
Stats: