Redux: Standards-compliant ES module build

Created on 27 Sep 2017  路  2Comments  路  Source: reduxjs/redux

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

Redux doesn't have a standards compliant es-module build that allows it to run in the browser as a native module without compilation from the user.

What is the expected behavior?

The build in the es directory should probably be made standards compliant by either rewriting the imports in the source or using rollup (which doesn't fix node_modules imports AFAIK) to produce a build of Redux that runs directly in the browser with a <script type="module"> tag.

What's missing?

The problem right now is that browsers supporting es-modules doesn't support importing with loosely defined paths such as ./compose or lodash/isPlainObject. Instead, the full actual path has to be defined with extensions and everything.

All 2 comments

Unfortunately, this stuff is so new, no one else in the ecosystem is doing this. Even if we were to update with correct URLs, our dependent packages wouldn't and would break things.

For the moment, you can use unpkg's module feature to accomplish this: https://unpkg.com/[email protected]/es/index.js?module But it's a little too early for us to figure this out, as we are dependent on things picking up in the ecosystem.

That's a shame since I just noticed that the normal dist version doesn't work either when importing from a module. Fails with this:

Uncaught TypeError: Cannot read property 'Redux' of undefined
    at freeGlobal (redux.js:4)
    at redux.js:5
Was this page helpful?
0 / 5 - 0 ratings

Related issues

captbaritone picture captbaritone  路  3Comments

rui-ktei picture rui-ktei  路  3Comments

elado picture elado  路  3Comments

ms88privat picture ms88privat  路  3Comments

CellOcean picture CellOcean  路  3Comments