I found that by targeting specific Stonecutter source files in my imports, I saved around 220 KB in my (webpack) bundle -- a little more than 80% (pre-minified) compared to importing without direct paths. Everything still functions perfectly:
// before
import { CSSGrid, layout, easings } from 'react-stonecutter';
// after
import CSSGrid from 'react-stonecutter/src/components/CSSGrid';
import simple from 'react-stonecutter/src/layouts/simple';
import { expoOut } from 'react-stonecutter/src/utils/easings';
To do this, though, I had to reconfigure webpack for .jsx files, add the /src path for compilation, and enable a few Babel loaders that I wasn't already using.
It would be great if the /lib directory could also include compiled versions of the modules in /src. You can see an example of this in the Redux source; see /src/applyMiddleware.js compared to /lib/applyMiddleware.js.
I would contribute this myself but am unfamiliar with the Gulp/Weback build config you're using. Otherwise I'm happy to pitch in where possible if you think this is worthwhile.
I found that by targeting specific Stonecutter source files in my imports, I saved around 220 KB in my (webpack) bundle -- a little more than 80% (pre-minified) compared to importing without direct paths. Everything still functions perfectly:
To do this, though, I had to reconfigure webpack for .jsx files, add the
/src
path for compilation, and enable a few Babel loaders that I wasn't already using.It would be great if the
/lib
directory could also include compiled versions of the modules in/src
. You can see an example of this in the Redux source; see/src/applyMiddleware.js
compared to/lib/applyMiddleware.js
.I would contribute this myself but am unfamiliar with the Gulp/Weback build config you're using. Otherwise I'm happy to pitch in where possible if you think this is worthwhile.