-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
jsmain:next should point to a “redistributable ES2015 bundle” #243
Comments
lol, currently it’s exactly the opposite: ES2015 with some ES2016 features except for ES2015 module syntax 😄 |
Please feel free to make a PR to fix this. |
sure. first i need to know: are you comfortable switching to ES2015 module syntax and relying on babel to convert it to in any case, the normal NPM bundle would be created as it currently is: babel with your current plugins and presets. switching module syntax would mean for the redistributable bundle: current stuff minus module-transformer not switching would mean: current stuff, after that use this to convert require syntax to ES2015 syntax (would probably need quite a bit of code to make it work outside of rollup. |
We just had a regression that forced us to go back to CommonJS: #233. I'm happy to revert this in React Redux 5 where we'll drop IE8 compat though. |
hmm, was es3ify no option? |
Seems inconvenient to add Browserify transforms to Webpack build. |
it’s also available for webpack but yeah, i can wait 😄 |
hmm, just thinking: your build system is basically but using the babel CLI means i can’t programmatically do: var options = JSON.parse(require('fs').readFileSync('.babelrc', 'utf8'))
options.babelrc = false
options.splice(options.indexOf('es2015-loose'), 1, 'es2015-loose-rollup')
babelDir('src', options) |
Would you accept a PR in the way redux has a rollup-able es6 module? https://github.com/reactjs/redux/blob/master/package.json#L25 |
Yes. |
Building ./es the redux way was straightforward and did build. I use npm link to test my local react-redux es build in a rollup test. When trying to rollup this error is thrown
My understanding is that The following changes would fix that, but I do not really feel confy changing src for this. :/ -import { Component, PropTypes, Children } from 'react'
+import React from 'react'
import storeShape from '../utils/storeShape'
import warning from '../utils/warning'
+const { Component, PropTypes, Children } = React At this point I almost want to give up rolling up dependencies and only rollup my own code. As the journey would countinue with react-router. Interestingly react-router already distributes es modules and uses |
Even if it worked, we don’t want to end up with the whole React in React Redux bundle. It’s not supposed to be embedded in the output. Webpack lets use set “externals” to express that; I presume Rollup has a similar mechanism? cc @Rich-Harris |
Yep, just add |
Using babel directly (as it is done in redux) wont include react and keeps import React from 'react' |
This should be fixed on |
what that means is “syntax the platform (browser/node) can read except for the ES2015 import/export syntax”
funnily my test project doesn’t work with specifically react-redux:
rollup(babel(), commonjs(), npm({'jsnext:main': true}))
→ rollup’s acon can’t parse the object spread syntax here'jsnext:main': false
→ babel-converted module with default comes out wrong rollup/rollup-plugin-commonjs#29cc @Rich-Harris @TrySound @Victorystick
The text was updated successfully, but these errors were encountered: