react-highlight-words icon indicating copy to clipboard operation
react-highlight-words copied to clipboard

dist is very large

Open Daniel15 opened this issue 5 years ago • 3 comments

dist/main.js is 57 KB: https://unpkg.com/[email protected]/dist/. Looking at the JS file, it appears to have chunks of React init (eg. PropTypes): https://unpkg.com/[email protected]/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!

Daniel15 avatar Jul 14 '19 20:07 Daniel15

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?

bvaughn avatar Jul 14 '19 20:07 bvaughn

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.

Daniel15 avatar Jul 27 '19 06:07 Daniel15

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)

jseminck avatar Dec 01 '19 11:12 jseminck