-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
This is fairly low on the priority list, especially since v1.0.0 is still looking to be shipped, but I wanted to document it for record keeping.
It would be great for SUIR to provide a bundle that maintains ES6 imports/exports so that bundlers that natively understand ES6 modules (webpack 2, rollup) can tree shake its usage in order to produce smaller bundles. Adding support for babel-plugin-lodash is already a great start, especially for webpack 1.0 and similar; this change would take it a step further by allowing bundlers to perform the same thing natively without the overhead of additional tooling.
Note: it's important that the code still be preprocessed with babel, because we should not assume anything else about the user's environment.
I believe that this is important piece of functionality, especially as the library grows, because it means that users don't have to be as concerned about the library's weight as a whole and can reap the benefits of targeted bundles without additional work on their part, especially as more bundlers implement tree shaking natively.
See:
- Add module entry point for webpack 2 remix-run/react-router#3672
- jsnext:main should point to a distributable ES6 bundle reduxjs/redux#1042
Steps
- Import SUIR in a bundler that understands ES6 modules.
- Do not use a plugin to transform imports (such as
babel-plugin-lodash)
Expected Result
Unused SUIR code should not be included in the final bundle.
Actual Result
All SUIR code is put into the bundle regardless of whether or not it was used.
Version
all