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

ES Modules for browsers #652

Closed
jonjharrison opened this issue Jul 15, 2020 · 4 comments
Closed

ES Modules for browsers #652

jonjharrison opened this issue Jul 15, 2020 · 4 comments
Milestone

Comments

@jonjharrison
Copy link

Would be great to add support for browser-friendly ES modules if possible - currently they don't load when loaded as modules from the browser because of the process.env.NODE_ENV references.

Looks like this was solved in the core redux package by adding an additional rollup config, would it be possible to have something similar for toolkit?

@markerikson
Copy link
Collaborator

Sure, happy to accept a PR on that.

@msutkowski
Copy link
Member

I did some digging around regarding this, and it seems like there is no easy way to get tsdx to do this at this time. I can swap out the regular ESM build with this browser-specific version like redux does but I've been unable to get multiple variations of the ESM build to happen. Ideally, we could just pass in a new custom build format (like 'mjs') and have it process the defined config for the format, but tsdx restricts the build to it's supported formats as it supplies defaults. There is some more context in this issue: jaredpalmer/tsdx#631, but it seems like the patch-package solution might be a little bit of a 🐰 🕳️. Maybe someone else can figure this out :)

@markerikson
Copy link
Collaborator

So this is a bit confusing to me. We apparently merged #658 a year ago, and that should have been in the 1.5.0 and 1.5.1 releases. But, I don't see any .esm.production artifacts in either published package.

So, I'm going to see if we can actually fix this in #957 , now.

@markerikson
Copy link
Collaborator

Should be resolved by #957 , and will be out in 1.6.

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

No branches or pull requests

3 participants