pauldijou / redux-act

An opinionated lib to create actions and reducers for Redux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ES Module isn't transpiled except for import/export

AndyOGo opened this issue · comments

I expect to import an ES Module and bundle it with Webpack/Rollup/Parcel without the need to transpile react-act itself by Babel.

I'm talking about the provided module field as definied by the spec below:

"module": "src/index.js",

This bug was introduced with 1.7.8

pkg.module will point to a module that has ES2015 module syntax but otherwise only syntax features that the target environments support.
https://github.com/rollup/rollup/wiki/pkg.module

Wait, it just means import and export – not other future JavaScript features?
Yes. ...
https://github.com/rollup/rollup/wiki/pkg.module#wait-it-just-means-import-and-export--not-other-future-javascript-features

Babel allows you to disable just module syntax transpilation:
https://babeljs.io/docs/en/babel-preset-env#modules

And Rollup, Webpack etc can be configured to target a specific module syntax.

commented

Similar as: #108

My bad, I messed up there. The change has been rollbacked in 1.7.9. Will take more time to check how to add it back correctly. Thanks both for pointing it out.

I haven't released it yet but pushed ae6cff2 for a correct support of module. Does it seem good to you both? @LucaMele @AndyOGo

commented

@pauldijou looks good to me.

@pauldijou awesome! yeah babel's modules field is a perfect option 👍

Cool, released in 1.8.0