Hacker News new | ask | show | jobs
by chrisco255 2925 days ago
Curious how Vue users are getting by without Webpack / Parcel for Babel and maintaining 3rd party dependencies via NPM? Copying and pasting Vue components from Stack Overflow? That approach may be fine for small web pages, but for commercial applications, it's not a viable approach.
2 comments

We avoid Webpack/Parcel and NPM dependencies entirely. I understand that convenience wins for most people, but it comes with a cost. Dependencies are magically stitched together with limited developer insight, arbitrary 3rd party code can make it into your production bundle on a whim, and it is far from "optimized" output.

We use rollup[1] for our production bundle. We manage all 3rd party dependencies by source control. We don't need to rely on NPM for ES5/ES6/CommonJS/AMD/Modules - We have full control of each dependency to use the code that is most fit. Sometimes that is already checked-in by the author, sometimes we need to build it, sometimes we can use the modern ES6 code directly, sometimes we can remove duplicate polyfills already in our bundle.

It takes bit more discipline, but the extra security, optimal build, and peace of mind knowing how things work, are well worth the effort to us.

[1] https://rollupjs.org

How do you update the dependencies when the author releases a new version? Sounds like it would be a lot of work....
You don't need babel if you don't use jsx (which for vue is the default). I've personally only used vue the way you would use jquery. Adding a full webpack/babel/npm stack with a build step and all would be too much work; I barely understand what webpack is in the first place.
If you barely understand what Webpack is then you probably aren't in a good position to argue for or against it's usage. You do need Babel if you intend to use newer JavaScript features but still have to support older browsers or even many mobile browsers. If you're only writing with ES5 features then you don't need any transpilation but many people want to use the new features available in newer versions of JavaScript/ECMAScript.

Webpack is great for, among other things, combining your code into single packages instead of including many script tags. It's also useful for optimizing the output of your build in various ways which makes it very valuable for large-scale applications.