claus / react-dat-gui

React dat.GUI
MIT License
292 stars 56 forks source link

Build file is too large. #14

Closed liyuanqiu closed 5 years ago

liyuanqiu commented 5 years ago

https://github.com/claus/react-dat-gui/blob/master/build/react-dat-gui.js

This file in the NPM package is too large:

Maybe you can add src directory into NPM package, then I can use it like this:

// just need 9.8KB before gzipped(includes my own code in this component)
import DatGui, { DatNumber } from 'react-dat-gui/src/index';

Or just do not webpack it while build, only compiles it by babel. Users really don't need your dependencies like React.

I really appreciate you to create this wonderful tool, which helps me in my work. But I have no more time to contribute code, so if you have a portal to donate, I'd like to do so.

rohan-deshpande commented 5 years ago

Heya, thanks for this. I guess we can add React as a peer dependency and bundle with babel.

reminjp commented 5 years ago

Since this package has used webpack, externals option in webpack.config.js may be useful. https://webpack.js.org/configuration/externals/

Move react and some other dependencies into peerDependencies and add them to the externals configuration option.

tim-soft commented 5 years ago

React and ReactDOM should really be moved into peer dependencies, not only does it blow up the bundle size but also inserts development builds of these into pages

rohan-deshpande commented 5 years ago

Just noting that this has the help wanted label all, feel free to submit a PR if it's an issue for you. Not sure when either myself or @claus will be able to get to it.

rohan-deshpande commented 5 years ago

Resolved by #18