Sage-9 Webpack Loaders Question

I’m new to Sage and since I’m also new to Gulp + have no production needs right now, I figured I’d just tackle learning Sage-9 with webpack. Right now, I’m decoding the webpack config and getting my head around the way it works and something stood out that I don’t understand…

Why aren’t the module.loaders using include to limit where its operates?

My understanding is that webpack traverses every single file down the base directory unless you include or exclude paths. With 62k+ files in node-modules/, wouldn’t this be slower than just including the key directories?

(Separately, can the discourse admin please add a webpack category? With all the amazing recent progress on Sage-9 (thanks, @patrickv!) I’m sure there’s lot of webpack discussions coming down the road)

No that’s not correct. Webpack doesn’t traverse every single file in node_modules. You specify entry points (main.js) and it builds the dependency tree from there.

1 Like

Duh…makes perfect sense. I need to find a good webpack introductory tutorial. :slight_smile: Thanks!

Did you find that tutorial? I could do with it :slight_smile:

I have not found anything that maps 1:1 the Sage-9 set up, so I’ve had to piece together different tutorials to get the bigger/better picture. Most of the stuff out there focuses on JS & React, so keep that in mind when you look for other tutorials.

If starting fresh, I would open up the Sage-9 webpack.config.js and package.json files and map the contents to the concepts within Webpack - The Confusing Parts.

Then, I would spend an afternoon going through [SurviveJS Webpack] (http://survivejs.com/webpack/introduction/). With the v1.1 version of this eBook just coming out 2 days ago, I bought it to support the author (and I like that 30% goes back to the author of webpack).

A lot of the magic is within the node.js modules within package.json and, sadly, most of it escapes me right now. It’s just voodoo magic until I get clarity. Also, I did not use Sage with earlier Grunt/Gulp implementations, so I’m not sure if that was an advantage or just added baggage.

If anyone finds something else, please post it here!

3 Likes

This is quite interesting - from instagram: https://github.com/petehunt/webpack-howto

1 Like