Remove unused deps, add stand-alone polyfill for weakmap#9
Conversation
|
P.S. I reviewed the changes in #5 before making this PR, and although these PR's have overlap, I don't think these are super related. Although this ticket simplifies the babel-config (somewhat), the main goal of this PR is to reduce the overall weight of the package. |
|
Please let me know if you have questions, or if you won't have time to merge these -- if that's the case, I'm happy to use my own fork for now. However, I think these changes greatly improve the library, and will make it easier for other developers to pick up as well. |
03926eb to
29a1a68
Compare
|
Many thanks for all your contributions! |
|
That would be great! |
|
Would you mind publishing the latest changes that have been merged to master? Although we haven't changed the public API, we have removed a bunch of the existing dependencies which could cause issues for users of this library, if they were relying on them transitively. We've also changed the dist path, which is technically not a breaking change, but if someone was relying on a file at file path, this could break them as well. It might be safer to publish this as a |
|
Additionally, if you can grant me access, I don't mind publishing the new version as well. |
|
It's been about a month since these changes were merged; any chance we can get them published, otherwise I'll have to publish a version of my fork. |
Background
So I'd really like to use this package, but after bundling it with my code I realized that this library brings an additional ~55k gzipped, which is just a non-starter for my project because our static asset size is really important to our user experience.
I took a look at the dependencies and I've made some changes:.
Changes
.nvmrcfile stating the library is built using Node 8 (this will ensure promises are available for test, and will have no impact on the runtime of the library, since we're transpiling anyway)..babelrcwith the babel-preset-es2015 preset, to ensure we're transpiling the library down to support browsers that dont fully support ES2016. I've also added a "build" command which generates thedistAfter these changes, I copied the built code into a project that uses react-traverse, and it still works as expected (hooray!), and I've also updated the tests config so the tests all pass as well.
Conclusion
These changes will bring the package size down from 55k (gzipped) to a about 800 bytes. I know this is a lot of changes, but almost all of these changes (except the weakmap replacement) have very little to do with the runtime of the library. Please let me know if you have any concerns!