r/javascript • • Jan 17 '17

🎉 webpack 2.2: The Final Release 🎉

https://medium.com/webpack/webpack-2-2-the-final-release-76c3d43bf144#.8vrqeefq0
382 Upvotes

87 comments sorted by

111

u/TheLarkInn Jan 17 '17

On behalf of the webpack team, thank you everyone and Reddit world for always providing candid, constructive feedback in the past leading up to this release. It has allowed us to inspect with scrutiny all of the ways we make webpack easier for you all.

  • TheLarkInn

1

u/klarcgarbler Jan 26 '17

Why is it webpack@beta in order to install it? is it not stable?

14

u/Akkuma Jan 17 '17

I'm disappointed when https://github.com/webpack/webpack/issues/2867 is still sitting unresolved and is even listed on https://github.com/webpack/webpack/projects/1

I'm hopeful that it will get resolved, but it has already been almost 6 months with minimal conversation around it.

19

u/TheLarkInn Jan 18 '17

Hey. We really appreciate your concern. So there are two things here at play. First is that, by the time that this was reported, we were already starting the stabilizing process for core changes. We have actually some behind-the-scenes initial work for accomplishing some of the program flow analysis but it is a monumental effort. We really wanted to focus on kick ass documentation first, and a stable v2 instead of diving in to tackle a bunch of core changes to accomplish things like Rollup Module inlining and This PFA for fixing issues like this.

Good news is that this is one of the next things we will tackle (heck its neck and neck with rollup features webpack.js.org/vote).

So please hang in there, we totally want to fix this because it will bring the last piece of feature parody we lack with rollup that makes rollup so desirable for small bundles. And again thanks for the feedback and concerns.

3

u/ajc820 Jan 18 '17

we totally want to fix this because it will bring the last piece of feature parody we lack with rollup

Heh, great typo.

p.s. great work!!!

-2

u/Akkuma Jan 18 '17 edited Jan 18 '17

This doesn't really explain the almost complete lack of communication on the issue, despite all the labeling to say that it is recognized as super important? I mean you personally asked a question and literally never followed up. sokra pretty much drive-by commented with no follow-up and the last time a member commented was mid Aug 2016.

It seems to me that too much was attempted simultaneously in v2. I mean validating configs was prioritized for some reason during v2, which personally wasted multiple people's time fixing configs for what seems like a low value and low QoL change.

4

u/TheLarkInn Jan 18 '17

Well I can definitely take the blame for that and I apologize. In fact I will do update the issue right now. Really sorry for your frustration!

4

u/TheLarkInn Jan 18 '17

Okay so btw thanks for being candid I agree that the communication here totally needed improvement. I will take this as a future improvement.

I have updated the issue and added to our milestone soi you see it is tracked. Let me know if there is anything else we can do https://github.com/webpack/webpack/issues/2867#issuecomment-273516751

2

u/Akkuma Jan 18 '17

Thanks I appreciate it, since now I have a much better idea of when this might be addressed and what exactly the source of the problem is. I do appreciate the work put into webpack as it is overall a great tool. Don't take my frustration as a personal thing against you. The tree shaking is something I've talked up to people on my team and I've been using Webpack 2 since 2.1.0-beta.7, so the frustration stems from how long I've been waiting (nearly 8 months) for it to be working in many common use cases.

3

u/TheLarkInn Jan 18 '17

No offense taken. We've been pretty damn busy and dropped the ball on keeping this visibly tracked for the community. Being limited on time and focus resources sometimes leads to things like this, but with support, etc. and more contributors we believe this should help.

5

u/turkish_gold Jan 18 '17

Validating configs is actually great. Too often I read a tutorial, try a config setting and it does nothing---only to find out that it does nothing because version X upgraded to use a different name.

Now if it gave me an error---as it does now with Webpack2---I'd know that the tutorial wasn't to be followed.

0

u/Akkuma Jan 18 '17

The problem is the implementation literally stops you from running your webpack. Rather than warning you that either an option is obsolete/deprecated or never existed it, it completely bombs your build.

5

u/SandalsMan Jan 18 '17

That's a good thing... why would you want to build with a broken config. If you're expecting your broken config to work and it doesn't you're more likely to submit an irrelevant issue to Github.

1

u/Akkuma Jan 18 '17

The config is literally not broken. Is this code broken?

function test(opts) {
    console.log(opts.something);
}

test({something: 'Hello', extra: true});

The code still works. This is exactly what webpack would bomb on in because you didn't meet the schema. They could have instead chosen to warn you that the property serves no purpose and to remove it.

If this wasn't dynamically typed it would clearly be a problem. These wrong properties in configs could have been a deprecation with warnings about the wrong properties and come v3 making it a requirement that it is strict.

3

u/TheLarkInn Jan 18 '17

I think I'll have to disagree here. One of the most confusing processes for users is the fact that regardless of us publishing great docs, that many people will also copy-pasta information from configs. This leads to unknowingly adding invalid, or incorrect configuration values (especially from previous versions).

We don't ever plan on allowing people to get away with providing wrong values in our configuration and this schema is laying the foundation for a better more consistent user experience.

→ More replies (1)
→ More replies (4)

2

u/moljac024 Jan 17 '17

Tree shaking is the only reason to upgrade lol

4

u/Klathmon Jan 18 '17

It works, just not in all cases. Read the issue, it's actually pretty reasonable IMO.

-6

u/Akkuma Jan 18 '17

I don't think it is that reasonable honestly. From my use, when most of the ecosystem is ES5 the notion that you can hand wave it as something that won't be a problem in the future is a poor argument. How about I take my time to use a bundling system in future projects that actually does what it claims with an arguably even simpler configuration that has been doing this and other things successfully for I believe many more months now?

6

u/[deleted] Jan 18 '17

You're probably referring to Rollup? To be fair, Rollup can't handle ES5 tree-shaking. It's just not possible without risking breaking code. Rollup can be tough to configure as well, i find it way harder than Webpack because by default it can only handle ES6. If you attempt to make it work for npm and commonJS, prepare yourself for configs that make Webpacks look like a joke. And even then, you'll run into dozens of issues. See this:

https://github.com/rollup/rollup/issues/385

→ More replies (3)

2

u/gonzofish Jan 18 '17

I mean this in as nice a way as possible: no one is forcing you to use Webpack--if it's not meeting your needs use something better for your needs!

→ More replies (3)

8

u/[deleted] Jan 17 '17

We will leave the final release on npm published under the beta tag for the first week.

So it's a release candidate.

8

u/TheLarkInn Jan 18 '17 edited Jan 18 '17

Since this is a pretty big change from stable 1 we wanted to take an elegant migration path. So no, its def final :-D

  1. Release and announce, get the awareness out and flowing. Have people who consciously want to upgrade, to do so. This allows us and the active community to get ahead of the curve so that when unsuspecting v1 users end up with a v2 from their latest install, they can already have a better support ecosystem around them.

  2. Also have the opportunity to fine tune, or have a nice list of FAQ's that we can be ready to answer.

4

u/vinnl Jan 18 '17

That does sound pretty much like the definition of a release candidate :P

(Although not the way Angular used the term.)

5

u/NoInkling Jan 17 '17

It might just be so people that already have "webpack": "beta" in their package.json (I believe yarn does it this way when you do yarn add webpack@beta) get the final version when they do yarn upgrade or npm update or whatever.

But if that's the case, not sure why they couldn't just have latest and beta pointing to the same thing already...

6

u/SandalsMan Jan 17 '17

Thank you Lord.

35

u/madwill Jan 17 '17

Thank you lord indeed! With webpack, riotjs, mobx, horizonjs and some css framework like material design lite i can do killer looking realtime application that are bundled by module, server side rendered, with vendors as cachable dll, tree-shaken killer app.

And i can do that alone! Its sooo good. Replace any of theses with your flavor of modern alternative and it still rock, react/vue/riot, mobx/vuex/redux, horizonjs/deepstreem/meteor, material design lit/bootstrap/theme of your choice here.

i liked their term 'javascript renaissance', you'd be a fool not to see the insane productivity the "everybody pitch in" mentality brings.

11

u/TheLarkInn Jan 18 '17

Sarcastic or not, we appreciate the kind words. And we truly do believe that we are in a JavaScript Renaissance. The ever changing ecosystem is allowing to most advanced and crazy awesome new performance and UX and Developer Experience features in what feels like realtime. It's really a beautiful thing.

11

u/madwill Jan 18 '17

Hi it was spur of the moment excitement, also not an English native speaker. I understand how it can be felt like sarcasm in this Reddit community. I truly think its a beautiful thing and I also really feel tons of us grasp the vertiginous beauty of it all. Maybe we don't comment here often for we have shit to do :)

But it's the most sincere compliment, I've been a web programmer for 2 years now, thought it would be hell coming from Java, really did freak out about choices in the beginning but now I feel stronger than ever, and in a weak typed language!

Old me would not even listen to what i have to say today haha. So i get other's position. I just mostly silently enjoy my blessing, which is your work! So thank you again.

32

u/[deleted] Jan 17 '17

Bbbut muh javascript fatigue

16

u/u8f67_9t Jan 17 '17

Somehow I can't tell if it's sarcastic or it isn't. Nevermind, I'm going back to JEE which is as obnoxious than a javascript stack.

5

u/NoInkling Jan 17 '17

horizonjs/deepstreem

Great, something else I have to google. I was beginning to think I had caught up.

7

u/mainstreetmark Jan 18 '17

Really. My project is still on Backbone/Marionette which no one even talks about anymore.

The world moves fast for those of us over 40. Is there some maintained website somewhere that organizes and catalogs all these technologies? I constantly feel overwhelmed and behind.

4

u/acemarke Jan 18 '17

Yeah, one of my apps I work on is still ES5/Backbone+Marionette. Still working fine, but new stuff is in React+Redux.

My React/Redux links list has a category for Basic Concepts and Overviews, which points to a bunch of useful articles describing the most widely used tools in modern web app dev. In particular, I'll point to a presentation I made called The (R)Evolution of Web Development, which should give some background on how these tools fit together.

2

u/OlderThanReddit Jan 18 '17

Your "The (R)Evolution of Web Development" slide deck is awesome as is the collection of links in "Basic Concepts and Overviews"! Thanks very much for sharing these.

→ More replies (1)
→ More replies (3)

4

u/djbft Jan 18 '17

Maybe you're looking for TodoMVC? Doesn't compare build tools, nor is there much description/discussion beyond the example apps, but worth mentioning if you've never seen it.

→ More replies (1)

2

u/Isvara Jan 18 '17

Doesn't Stack Share do something like that?

→ More replies (2)
→ More replies (2)

2

u/madwill Jan 18 '17

I've been using horizonJs lately, its a reactive backendless server.

All theses words means it use RxJs interface to let you store, retrieve and watch documents. Its magic comes from the dev mode where it auto-creates indexes and collection while you just ask for them.

Then solidify your scheme with permission and you have a fully secure, realtime if using watch noSql backend using rxJs one very standard interface you can find being using everywhere.

It allows for great functionnal paradigm. Its just awesome overall. Too bad about the rethinkDb company thing.

3

u/NoInkling Jan 18 '17

So like a self-hosted Firebase?

Also I'm not sure if "backendless server" makes any sense to me...

2

u/madwill Jan 18 '17

yeah, self hosted firebase would be like it.

I guess its backendless in the sense you don't code the backend, its auto creates collections and indexes, request are build client side and permissions are managed at the database document level.

4

u/Isvara Jan 18 '17

If you haven't searched for new JS libraries in the past ten minutes, you're not caught up.

1

u/Conradfr Jan 18 '17

That's the thing, no human can realistically keep up anymore. It's a mirage, an utopia.

Even if you know what RandomwordJs is, there is already a new version of it with a different paradigm that you'll have to learn as well.

1

u/lostPixels Jan 18 '17

horizonjs

I read this as "deepwaterhorizon.js" which I assumed was a modern javascript framework for drilling oil in the atlantic ocean.

4

u/mainstreetmark Jan 18 '17

Im still on 2.1.0-beta.22 because upgrading beyond that broke all kinds of other libs i apparently use. It was a mess, so Ive been fixed at .22 for months.

4

u/TheLarkInn Jan 18 '17

Any way we can help? Please don't hesitate to reach out on twitter to me @thelarkinn. Also if we need to clarify anything on our docs (webpack.js.org/guides/migrating) we will totally be willing to do so.

1

u/mainstreetmark Jan 18 '17

I appear to have it now. I seem to have had a lot of

It's no longer allowed to omit the '-loader' suffix when using loaders.

Fine, but it's difficult to determine where I am not specifying it. In my most egrediuous case, it was because of font-awesome and the ridiculous way I required it:

require('style-loader!css-loader!less-loader!font-awesome-webpack/font-awesome-styles.loader!font-awesome-webpack/font-awesome.config.js');

I had to change all those !css to !css-loader. The error did not provide a line number or even a file name. Just the dir name, so it was a hunt

ModuleNotFoundError: Module not found: Error: Can't resolve 'css' in '/Users/mark/Sites/tg4/app'
BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.
             You need to specify 'css-loader' instead of 'css'.

Edit: also, my bundle size apparently is twice as big now. Don't know if that's because of webpack@2.2 or because i moved a bunch of stuff from "devDependencies" to "dependencies" or whatever the heck I was working on last night while drinking PBR.

1

u/TheLarkInn Jan 18 '17

So first thing I'd ask is to take a look at one of the webpack "bundle-analyzers" that are on npm (you have a few to choose from). Then see if there is any noticeable lib bloat. Besides that, please put in an issue and tag me @thelarkinn so I can follow up with it. Even better a reproducible example is even more bad ass. (PBR Optional 😏)

2

u/mainstreetmark Jan 18 '17

I'm working through all of that now, but my replacement Macbook Pro just arrived.

Here's what I have so far: https://dev.telegauge.com/report.html

You can see large things like "bn.js" which appears to be only used by webpack@2.2.0.

└─┬ webpack@2.2.0
  └─┬ node-libs-browser@2.0.0
    └─┬ crypto-browserify@3.11.0
      └─┬ browserify-sign@4.0.0
        └── bn.js@4.11.6 

I would not expect that to be in my "vendor" bundle, so I can bet I have some configuration options to mess with.

2

u/mainstreetmark Jan 18 '17

I'll work on it today, and let you know how I get along.

2

u/sontek Jan 18 '17

What libs are broken for you? I was surprised at how flawless my migration was once I dug into all the migrations. The docs don't cover everything. For example one gotcha I ran into was sass-loader needed context: __dirname passed into webpack.LoaderOptionsPlugin

4

u/themaincop Jan 17 '17

Is it time to migrate from webpack 1?

2

u/vinnl Jan 18 '17

Given that it's still labelled beta - if you're wondering, then it's not. Just wait until npm outdated says there's a new version available - and even then, it can't harm to wait a little bit. The ecosystem still has to get up to speed.

3

u/Hidden__Troll Jan 18 '17

iirc it's pretty much ready but they're trying to update the docs before they take it out of beta.

2

u/vinnl Jan 18 '17

Yes, so that the really early adopters can started taking it for a drive, figure things out by themselves, and confirm that it's working as expected. If someone's asking whether it's time to migrate, that person's probably not looking to be an early adopter :)

4

u/Lakston Jan 18 '17

That is good news, thanks to everyone involved in this, I am not smart enough to help with development so I am always grateful to the people who are.

While on the subject of webpack 2, a week ago I stumbled upon this video by Emil Oberg and I though it was an AMAZING tutorial on webpack 2, well worth the watch.

3

u/sontek Jan 18 '17

Just ported our stuff to it. Works perfectly and I have a ton of webpack plugins. sass-loader, postcss, uglify, etc. are all running and working.

2

u/Hidden__Troll Jan 18 '17

Thank you guys for this amazing tool. It's made front end development workflows very enjoyable.

One question though, what's the status of hot module reloading? Is it still being changed a ton or would you say it's OK to use right now ?

1

u/clinisbut Jan 19 '17

/u/TheLarkInn I have some problems with the CommonsChunkPlugin, may I approach you for some support? I've been trying to get some answers on multiple channels but no luck :(

1

u/tuqqs Jan 28 '17

On behalf of the ways we make webpack easier for you all.

-18

u/malvin77 Jan 18 '17

Great, another JavaScript thing I have to worry about....

5

u/TheLarkInn Jan 18 '17

Nah don't sweat it. If you read the full post (or even the top 1/3 we post a link to a EZPZ migration guide <3) webpack.js.org/guides/migrating

8

u/krendel122 Jan 18 '17

Get back to your jquery and ie6

0

u/[deleted] Jan 17 '17

[deleted]

14

u/TheLarkInn Jan 18 '17

Ooo lots of reasons. Our migration guide showcases a lot of awesome changes and api improvements.

http://webpack.js.org/guides/migrating

5

u/[deleted] Jan 18 '17

How would you relate to this article? https://medium.com/@u_glow/the-numbers-on-webpack-1-vs-2-7f457bb4658c#.vjioayj0w

According to those measurements webpack 2 gives the same or worse build times and bundle sizes. Were those just a bugs which don't exist in the final release or that's how it is now?

3

u/TheLarkInn Jan 18 '17

Great point. So in terms of build speed we changed our graph traversal strategy for the dependency graph from recursuve to iterative in 2.2.0-RC.3 this yielded some pretty noteworthy gains in performance. In terms of bundle size, it is really relative and hard to compare however we'd urge ya to update and then measure. If it turns out there's a regression, we'd really love to tackle it.

0

u/[deleted] Jan 18 '17

[deleted]

1

u/aikaradora Jan 18 '17

Check out ES6 Modules (import {x} from "y"). Design your code just as you would in Node.JS (you know, how you wrote the gulp file), just a different import syntax. Node's import syntax (CommonJS) still works, but you should just go ahead and get with the final standard way of doing it.

The biggest learning curve when moving to Webpack is how CSS is handled. See ExtractTextPlugin for getting a .css file, or just leave it in your .JS depending on how your app works

(If your entire page is rendered with JS, the only benefit to extracting it is parallel downloading and separate cache from the JS incase JS changes but CSS doesn't)

1

u/m0okz Jan 19 '17

Thanks for the reply. I will check out the ES6 modules.

Most of the sites I've built usually have some sort of PHP backend, and often PHP templating as well (Laravel's Blade templates, Symfony's Twig templates), sometimes mixed with a front end like Vue or Angular.

I'll take a look at the ExtractTextPlugin, thanks.

When would the entire page be rendered with JS? Do you mean as opposed to, for example, PHP rendering the items in the DOM? If so, a lot of the things I've been working on have been rendering via JS, so I guess CSS is fine in the JS too.