Ask anything to webpack Team

webpack is a bundler for modules. The main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.

Feel free to ask any high level questions about webpack. This is also a great opportunity for you to know more about the awesome developers who develop and maintain webpack.

Hosted by:

Ask a Question

102 discussions

What are the highlights of webpack 2?

  • new features?
  • breaking changes?
  • motivations?

We published a gist that explains the changes in detail. Here is a short summary:

webpack 2 will have native ES6 Modules support (including Code Splitting with ES6 through SystemJS semantics). The resolving backend changed as well. This means existing resolving plugins may no longer work and the configuration changed so that it hopefully makes more sense now. There are many small breaking changes that cover edge cases.

The motivation was to fix all the breaking changes that summarized during webpack 1 and to add ES6 support. Originally I also planned to change the ways loaders are configured, but I had no time to implement this. So this will probably be a plugin or webpack 3 thing.

Reply to this…

Hashnode is a friendly and inclusive dev community.
Come jump on the bandwagon!

  • 💬 Ask programming questions without being judged

  • 🧠 Stay in the loop and grow your knowledge

  • 🍕 More than 500K developers share programming wisdom here

  • ❤️ Support the growing dev community!

Create my profile

Why did you create webpack in the first place?

What what the main motivation when you started the project?

Show all replies

I did not create webpack, but I have an anecdote :)

In 2011, I've created a similar module as part of my bachelor thesis. I hadn't discovered browserify back then and I did not know about an AST, so I tried to "parse" the JavaScript with a RegExp (spoiler: don't even try to do this). Shortly after finishing the module, I realized that it was a stupid idea and maintenance hell. I switched to browserify and even contributed some lines to it. However, I quickly realized that browserify was not powerful enough (browserify@1 had a different architecture back then). I think, one main reason for me was code splitting as well. So I did a research and found webpack (having around 70 stars and some downloads). It had already all the features I was looking for:

  • Code splitting
  • Hashing
  • CommonJS + AMD support

So, I decided to give it a break (although there was almost no documentation available) and I think it was a good decision.

Reply to this…

What is the best way to load essential modules first and fast, while lazy loading other modules in background?

Create an entry point for each place where a user can start using your page. This means in a SPA create multiple entry points if there are multiple pages. Put everything you need to display the page into that entry point. Everything else should be loaded on demand via Code Splitting. Use prefetching to trigger the download earlier, i.e., start the code download on hover.

If you want to get even faster, you can load expandable content on-demand or content below the fold too. Just trigger the code download when the initial stuff is displayed.

Reply to this…

What is the best way to specify that a loader should compile a dependency from npm and have that working with npm link? I see that there are some issues with path.join and path.resolve with the resolve and resolveLoader settings.

Show all replies

For sure.

I am using a repo that has React components as a dependency for another React project (let's call this the parent_repo), both of which use ES6 and 7 syntax. So I would like to use webpack with parent_repo and tell the babel loader to compile my child_repo, instead of the usual ignoring of node_modules. I'm trying to be able to develop fast locally by being able to npm link the child_repo and have webpack recompile both the parent and child, seeing changes with HMR. Perhaps even my setup is blasphemous.

When I use npm-link though, a lot of the resolving goes haywire. I have a number of plugins for the parent_repo and they cannot be found when the child_repo is compiling. Similar problems for loaders.

Reply to this…

How do you compare Webpack with JSPM? Do you think they are different tools for different purposes?

Show all replies

Yes, diversity drives innovation! We should not think Open Source in a "corporate" way. It's all about ideas.

For instance: I really appreciate rollup's efforts on scope collpasing. Other projects are able to benefit from its insights.

Personally, I haven't discovered the real benefits of JSPM yet. I think it's misleading to say that JSPM is future proof, because imho ES2015 module loading semantics have not been figured out yet. Browser vendors and node.js contributors are still struggling with the actual implementation of the loader spec (that's at least what I can tell from my point of view).

Reply to this…

Load more responses