What features does Webpack 2 offer over Webpack 1?
Webpack 2, RC 7
21–28 of 28 posts
Re: Webpack 2, RC 7
#22I wonder if the performance has improved.
Re: Webpack 2, RC 7
#23Earlier quoted context omitted.
My favorite change is how configuration has been clarified. For example, see how loaders are configured now - instead of using a giant string delimited by special characters like this: 'css-loader?modules-true!postcss-loader!sass-loader' Loaders are configured with an ordered list: [ { loader: 'css-loader', options: { modules: true } }, { loader: 'postcss-loader' }, { loader: 'sass-loader' } ] It takes up way more sp…
After having used both Webpack 1 and 2, my favorite feature is simply most of the insanity being gone. I was hitting my head against my desk setting up npm and webpack 1 for almost 3 hours a couple of weeks ago. I then said fuck it, replaced them with yarn and webpack 2 respectively and all my issues were fixed. Truly magical.
Re: Webpack 2, RC 7
#24Re: Webpack 2, RC 7
#25Is there a list of all the changes for Webpack 2, or an upgrade guide?
Re: Webpack 2, RC 7
#26Earlier quoted context omitted.
System.import split-points for code splitting, generates bundles with dependencies for lazy loading by route (automatically code split react router routes). Should make progressive web apps and optimization easier.
yes, best feature. before you had to use systemjs and jspm or something.
Re: Webpack 2, RC 7
#27Earlier quoted context omitted.
Except in my experience (and others as well) the tree shaking hasn't been working.
The problem with tree-shaking is that it's recursive -- every module has to do it properly, and at the moment, I'd wager most frontend modules in NPM don't. If I responsibly say `import { map } from 'lodash'`;, but (say) my frontend rendering library says `import _ from 'lodash'; _.map(things, func);`, then unfortunately, transitively, I'll still get all of lodash.
Re: Webpack 2, RC 7
#28Earlier quoted context omitted.
The problem with tree-shaking is that it's recursive -- every module has to do it properly, and at the moment, I'd wager most frontend modules in NPM don't. If I responsibly say `import { map } from 'lodash'`;, but (say) my frontend rendering library says `import _ from 'lodash'; _.map(things, func);`, then unfortunately, transitively, I'll still get all of lodash.
You might be able to fix that with something like babel-plugin-lodash which can be ran over your code (and deps) to enforce cherry-picking across the board. https://github.com/lodash/babel-plugin-lodash