Ship a module build
See original GitHub issueIf you look at the latest commonJS build, you’ll see this require statement:
var _reduxActions = require("redux-actions");
This imports all of redux-actions – which doesn’t sound like a lot, but they depend a lot of utilities, for example, lodash.curry
– which is 33kb. Only createAction and handleActions are imported. (A different function in the redux-actions library imports lodash.curry).
I propose we ship a module build. Module builds are just like commonjs builds, except they use ES Module import syntax – which is important for tree-shaking.
It’s 100% backwards-compatible. You’d add a “module” property to package.json to point to the ES module build. Then people using tools like rollup and webpack will get the benefits of treeshaking awesomeness.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Create, build and ship a Python3 pip module in 5 minutes
Let's ship some modules. Shipping pip packages — the automated way. Prerequisites. PyPi account. Register here and save your credentials in a ...
Read more >Modularisation - Establishing New Ship Building Mindsets ...
“In essence, the project is about how to build the same ship for different purposes – creating one ship family for three different...
Read more >T1 Ship and Module Production - EVE HOW TO
T1 ships and modules only need the most basic raw materials to build, which are minerals. These are gathered in form of ore...
Read more >help with ship building : r/playatlas - Reddit
Wikipedia seems to be completely outdated about the ship building ... me to progress into a ship I can actually edit and attach...
Read more >Submitting module builds in Fedora
fedpkg module-build requires an authorization to MBS. Fedora infrastructure uses OpenID Connect ... Generally, in Fedora we do not ship the -devel modules....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Everything will still ship as one NPM module. I meant two libraries within the existing
feathers-redux
NPM module: the (existing) commonjs build and an additional esmodule build.It’s best to use the
main
andmodule
package.json fields to point to the commonjs and esmodule builds (respectively). This allows for better support of the module in server and client environments.For example, suppose in source code you were require
feathers-redux/commonjs/index.js
orfeathers-redux/esmodule/index.js
. If you’re compiling the code on the client, and you pick the esmodule build, then you get the tree shaking awesomeness. But if you’re using the module on the server (which in this case, is possible because of server-side rendering), you need to compile your server code (since NodeJS core doesn’t support import-syntax).If the package author declares defines
main
andmodule
fields in package.json, you just importfeathers-redux
, and based off of your environment and build tools, you will automatically resolve to the commonjs or esmodule build.I’ll do a PR for it soon. Since it’s totally backwards compatible and won’t break anyone, I think you’ll be happy to accept it.
@abecks I’ve opened https://github.com/feathers-plus/feathers-redux/pull/60.
This probably isn’t as beneficial as it would’ve been before, but it would still be a good addition. When I opened this issue,
redux-actions
was much larger:At the time,
v2.6.1
was the latest release (18.7kB / 6.9kB). The latest release,v2.6.5
is 7kB / 2.7kB.