Skip to content
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

dist is very large #86

Open
Daniel15 opened this issue Jul 14, 2019 · 3 comments
Open

dist is very large #86

Daniel15 opened this issue Jul 14, 2019 · 3 comments

Comments

@Daniel15
Copy link

dist/main.js is 57 KB: https://unpkg.com/react-highlight-words@0.16.0/dist/. Looking at the JS file, it appears to have chunks of React init (eg. PropTypes): https://unpkg.com/react-highlight-words@0.16.0/dist/main.js

If I use your code from Git rather than npm, it shaves 13 KB off the minified size, mainly due to no longer including duplicate modules in the bundle, and PropTypes properly using the production mode. In my package.json I'm doing:

"react-highlight-words": "bvaughn/react-highlight-words#2d214bd70182a4ca95d50f18e74bd821e0847dcd"

Would it be possible to publish an ES6 Module version to npm too, so as to not introduce duplicate modules to apps that want to use this one?

Thanks!

@bvaughn
Copy link
Owner

bvaughn commented Jul 14, 2019

Haven't used this library in years. No current plans to update it and no desire to maintain it. Would be happy to give you permission to publish an update though if you'd be interested?

@Daniel15
Copy link
Author

Thanks for the reply! Unfortunately I don't think I'll get any time to look into it any time soon :( I ended up using a different library instead.

@jseminck
Copy link

jseminck commented Dec 1, 2019

I've noticed the same and tried to spend some time to reduce the bundle size, however I'm not able to get anywhere with adding this babel plugin: https://www.npmjs.com/package/babel-plugin-transform-react-remove-prop-types

Could it be because the version of babel is too old (babel 5.x)?

ModuleBuildError: Module build failed: TypeError: The plugin "transform-react-remove-prop-types" didn't export a Plugin instance
    at PluginManager.validate (/Users/joachimseminck/git/react-highlight-words/node_modules/babel-core/lib/transformation/file/plugin-manager.js:164:13)
    at PluginManager.add (/Users/joachimseminck/git/react-highlight-words/node_modules/babel-core/lib/transformation/file/plugin-manager.js:213:10)
    at File.buildTransformers (/Users/joachimseminck/git/react-highlight-words/node_modules/babel-core/lib/transformation/file/index.js:237:21)
    at new File (/Users/joachimseminck/git/react-highlight-words/node_modules/babel-core/lib/transformation/file/index.js:139:10)
    at Pipeline.transform (/Users/joachimseminck/git/react-highlight-words/node_modules/babel-core/lib/transformation/pipeline.js:164:16)
    at transpile (/Users/joachimseminck/git/react-highlight-words/node_modules/babel-loader/index.js:12:22)
    at Object.module.exports (/Users/joachimseminck/git/react-highlight-words/node_modules/babel-loader/index.js:71:12)
    at NormalModule.onModuleBuildFailed (/Users/joachimseminck/git/react-highlight-words/node_modules/webpack-core/lib/NormalModuleMixin.js:315:19)
    at nextLoader (/Users/joachimseminck/git/react-highlight-words/node_modules/webpack-core/lib/NormalModuleMixin.js:270:31)
    at /Users/joachimseminck/git/react-highlight-words/node_modules/webpack-core/lib/NormalModuleMixin.js:292:15
    at runSyncOrAsync (/Users/joachimseminck/git/react-highlight-words/node_modules/webpack-core/lib/NormalModuleMixin.js:173:4)
    at nextLoader (/Users/joachimseminck/git/react-highlight-words/node_modules/webpack-core/lib/NormalModuleMixin.js:290:3)
    at /Users/joachimseminck/git/react-highlight-words/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5
    at Storage.finished (/Users/joachimseminck/git/react-highlight-words/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16)
    at /Users/joachimseminck/git/react-highlight-words/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants