Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ES-browser build #3143

Merged
merged 7 commits into from
Sep 25, 2018
Merged

Conversation

TimvdLippe
Copy link
Contributor

@TimvdLippe TimvdLippe commented Sep 20, 2018

This build is intended for users who want to use Redux in a browser with ES modules support. The build removes all references to process by assuming it is in a production environment.

Additionally, it does not transpile, as all browsers that have ES modules support also support ES2015+

This approach is similar to the one of Vue (vuejs/vue#7110) which I have also been using with success.

Fixes #2907

This build is intended for users who want to use Redux
in a browser with ES modules support. The build removes
all references to `process` by assuming it is in a
production environment.

Additionally, it does not transpile, as all browsers
that have ES modules support also support ES2015+
@timdorr
Copy link
Member

timdorr commented Sep 25, 2018

Hey Tim, it's Tim 😄

I'm wondering if we can keep this in the es path, but output redux.browser.js or something like that.

What happens with symbol-observable in this bundle?

@TimvdLippe
Copy link
Contributor Author

Hey! Yes that should be possible. Let me take a look on how to configure rollup for that.

Because ES modules are scoped, symbol-observable is bundled in. While this is a very small performance penalty (in the scenario that you would use symbol-observable somewhere as well), the package is so small I doubt it is relevant.

@TimvdLippe
Copy link
Contributor Author

@timdorr Updated, PTAL 😄

@timdorr
Copy link
Member

timdorr commented Sep 25, 2018

I'm actually mucking about with the babel and rollup configs right now. I'll have a conflict ready for you in just a second...

@TimvdLippe
Copy link
Contributor Author

@timdorr Conflict should be busted 🎉

@TimvdLippe
Copy link
Contributor Author

Hm, let me actually minify just like the minified umd build.

@timdorr
Copy link
Member

timdorr commented Sep 25, 2018

Cool. I renamed it to just redux.mjs for simplicity. Forgot about that extension.

@timdorr timdorr merged commit d7c5816 into reduxjs:master Sep 25, 2018
@TimvdLippe TimvdLippe deleted the add-es-browser-build branch September 25, 2018 18:55
@TimvdLippe
Copy link
Contributor Author

Thanks for the quick review @timdorr ! Can't wait for the next release 🎉

@TimvdLippe
Copy link
Contributor Author

@timdorr What is the ETA of a release of a new version of Redux which includes this PR?

@Andarist
Copy link
Contributor

According to ES modules support taken from here - https://github.com/babel/babel/blob/6b8261bbb7ebb8d2980cb30c3b3369678fd99835/packages/babel-preset-env/data/built-in-modules.json#L1-L11 and testing only desktop browsers quickly it seems that used object rest spread syntax in the es/redux.mjs is not supported in those verstions of Edge & Safari.

Depending on what the audience of this bundle is it might need to get adjusted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants