-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Upgrade to webpack v2 #189
Conversation
@@ -46,7 +46,7 @@ | |||
"eslint-plugin-import": "1.10.3", | |||
"eslint-plugin-jsx-a11y": "2.0.1", | |||
"eslint-plugin-react": "5.2.2", | |||
"extract-text-webpack-plugin": "1.0.1", | |||
"extract-text-webpack-plugin": "^2.0.0-beta.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed otherwise webpack fails with an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we must remove caret because it's in beta and api can be changed.
I faced with this today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, that was an accident! Good catch!
Don’t worry about it, it is literally just exponentiation operator. All the meat is in 2016, and it doesn’t include 2015 by itself. |
@@ -56,7 +56,7 @@ | |||
"rimraf": "2.5.3", | |||
"style-loader": "0.13.1", | |||
"url-loader": "0.5.7", | |||
"webpack": "1.13.1", | |||
"webpack": "^2.1.0-beta.20", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also caret here
I’d never think it would be so easy 😄 |
Removed
Same size for the main bundle, not 100% if that's expected or not anymore. Also just realized that the |
To help debug issues, people can always delete them if they want to. |
Why? I meant that it’s orthogonal to commonjs support, not that it needs to be removed 😉 |
Pass |
Sure, we wouldn’t get any benefits with vanilla React. I’m more interested in Webpack 2 because it’s easier to get fixes into it than backport them to 1.x. |
|
@@ -9,8 +9,7 @@ | |||
|
|||
module.exports = { | |||
presets: [ | |||
'babel-preset-es2015', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, it's weird that this isn't es2015-loose. I can't think of any good reason to not use es2015-loose (and correspondingly es2015-loose-native-modules instead of either es2015-native-modules or es2015-webpack) for production.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes all the transforms run in loose mode. It's like es2015-loose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's like es2015-loose.
Haha that's what I'm asking, what is loose mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loose mode generates code that is simpler, but less strictly compliant to spec. Compare output:
I'm not aware of any reason to not at least run your production build in loose mode. I'm also not aware of anybody who deliberately uses non-loose mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's it, some people would rather be compliant to the spec even though there's more output, etc
I wish that was the case, but if I understand this correctly it isn't! It includes |
Well, Node 4 with npm 2 fails because there's lots of invalid EDIT Wait, what am I missing here, doesn't
|
You have the wrong version of webpack-dev-server |
aka npm error messages are useless |
Try using es2015-loose-native-modules for babel, works great with webpack 2 and is dead simple. |
@mxstbr that repo is the old one, before I asked to move it to babel. es2016 just includes the exponential operator https://github.com/babel/babel/tree/master/packages/babel-preset-es2016 |
I wish it were named |
@taion What we really need to do is just merge babel/babel#3331 it again if it makes sense) @loganfsmyth - then everyone can just use es2015. |
@hzoo That'd be fantastic if it could happen. It's just painful to set up Babel to produce both a CJS and an ES module build right now. |
Update: let’s keep it open but hold it off until Webpack 2 is out of beta. Thanks for your effort! |
Meh, keeping it open doesn’t help anyone. I really appreciate your work on this @mxstbr, and I’ll dig it up when Webpack 2 is stable / more official. Thanks! |
Yeah I was wondering about that 😁 |
FYI: #1291 was merged instead of this |
Ref #183
This is a first step towards webpack 2. Everything builds and works just fine.
Build stats:
v1
v2
I think nothing is different because we have to not use
babel-plugin-transform-es2015-modules-commonjs
, which is whatbabel-preset-es2015-webpack
does so we get the benefits of tree shaking.Annoyingly we're using
babel-preset-es2016
, which doesn't have ababel-preset-es2016-webpack
withbabel-plugin-transform-es2015-modules-commonjs
removed!Would appreciate somebody forking
babel-preset-es2016
, removing that, publishing it and trying it with this PR!I'm going to bed now, feel free to continue the work against the
webpack-v2
branch!