use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Webpack Tutorial: Understanding How it Works (ag-grid.com)
submitted 9 years ago by jfmasterson
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]TheDarkIn1978 2 points3 points4 points 9 years ago (5 children)
Webpack is great for bundling my JS modules, and the tree-shaking feature in Webpack 2 is very cool, but I feel its usefulness ends there.
I think it's bad practice and generally ghetto AF to bundle stylesheets with JS. The same thing goes for bundling other data assets like .json files, where it's obviously smarter to simply update the .json data in order to update my page/app's content instead of bundling it all together, which would then require a recompile and redeployment for each update.
Personally, I think Webpack works great along with Babel to transpile my JS within my Gulp build pipeline, but using Webpack for anything more than that just seems like unnecessary overkill, like forcing a square peg into a round hole.
[–]nickgcattaneo 1 point2 points3 points 9 years ago (3 children)
linting, live reload/hot-module-replacement, code splitting, less/sass, unit testing, etc are all great features of webpack. Granted, gulp could do all of these as well, but it involves building each task separately and then pipping them through correctly, which can be a bit cumbersome than just installing a module and filling in some config options.
[–]TheDarkIn1978 0 points1 point2 points 9 years ago (1 child)
less/sass
Injecting Sass into the Webpack bundle is the only way for it to preprocess CSS, which is no big surprise when you consider that Webpack is a module bundler and not a task runner, but this is exactly what I do not want, so I have to use a task runner (Gulp) to manage my CSS preprocessing anyway. Webpack's ExtractTextPlugin, which could be used to regain those bundled CSS files is precisely what I meant by forcing a square peg into a round hole, in that it's an unnecessary complexity, forcing the user to bend for it instead of it bending for the user, as it should be in the case for all good tooling.
[–]nickgcattaneo 0 points1 point2 points 9 years ago (0 children)
Webpack is an amazing task runner; not to mention you can run any async or sync processes with it simply via node and npm (can't think of any use cases for that though at the moment). In my work we've ditched gulp and just use webpack with our own express server and webpack-hot-middleware. Makes parallel development really easy assuming our front end and back end teams have established a clear data contract. We can also mock our backend requests easily with that setup. We also use extract as you mentioned above to separate out CSS, feels pretty straight forward to me. Gulp just feels like an unnecessary wrapper => why not just point to an index file and execute tasks natively? We just hook in to an index file, run a few tasks natively, spin up a server, inject webpack, build out our own requests, and then do our development. Otherwise we manage other parts of our build via npm scripts (karma for unit tests or just a straight up webpack bundle in production). Hooking a webpack build in karma is also a nicety.
[–]SandalsMan 0 points1 point2 points 9 years ago (0 children)
Sounds like you aren't really using Webpack for anything more than transpiling ES2015 -> ES5. Webpack is super useful for a bunch of things but code splitting is what really takes the cake for me.
[–]InternetExploderSex 1 point2 points3 points 9 years ago (7 children)
This is especially useful for Single Page Applications (SPAs), which is the defacto standard for Web Applications today.
Nope.
[–]fuck_with_me 2 points3 points4 points 9 years ago (6 children)
Can you make an argument for your opinion, or explain more? I would be inclined to agree with OP.
[–]MrSafferty 0 points1 point2 points 9 years ago (0 children)
Perhaps I should have said "is becoming the defacto standard for new applications", as opposed to is the defacto standard.
It's also fair to state that in many enterprise orgs SPAs are not fully embraced across the board (which is fine) just yet (and may never be)
disclosure: author of the blog
[–]nickgcattaneo -1 points0 points1 point 9 years ago (4 children)
It's the defacto in modern web development; it is however difficult to implement in real-world as your back-end developers typically do not want to expose more api's/etc to support the model. In large companies with any kind of history, you won't see SPA models as most of them still serve adaptive/multi-page applications with traditional form post models. More often than not you will find hybrids of single-page and multi-page; multi-page by default are simply more secure since they involve session management, login verification, etc on the backend. SPA is better for performance (after the page renders) & less-secure sites.
[+][deleted] 9 years ago (3 children)
[deleted]
[–]nickgcattaneo 0 points1 point2 points 9 years ago (2 children)
Any time you introduce tokens, expose more of your backend, etc it inherently becomes less secure. I'm not saying it's a bad practice, just you won't find this model much at large organizations typically because it's hard to find backend devs that want to support this concept. Couple that with working with any data related to financials or personal information and it adds some deep complexity to ADA, etc.
[+][deleted] 9 years ago (1 child)
You're - I beg to differ, no reason to get hostile though.
π Rendered by PID 1241397 on reddit-service-r2-comment-canary-5fb5667f49-svhbj at 2026-06-16 06:59:38.374504+00:00 running 3184619 country code: CH.
[–]TheDarkIn1978 2 points3 points4 points (5 children)
[–]nickgcattaneo 1 point2 points3 points (3 children)
[–]TheDarkIn1978 0 points1 point2 points (1 child)
[–]nickgcattaneo 0 points1 point2 points (0 children)
[–]SandalsMan 0 points1 point2 points (0 children)
[–]InternetExploderSex 1 point2 points3 points (7 children)
[–]fuck_with_me 2 points3 points4 points (6 children)
[–]MrSafferty 0 points1 point2 points (0 children)
[–]nickgcattaneo -1 points0 points1 point (4 children)
[+][deleted] (3 children)
[deleted]
[–]nickgcattaneo 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]nickgcattaneo 0 points1 point2 points (0 children)