vuejs-templates / webpack-simple

A simple Webpack + vue-loader setup for quick prototyping.
2.27k stars 894 forks source link

Update dependencies, including webpack v4 #184

Closed robcresswell closed 6 years ago

robcresswell commented 6 years ago

This commit updates the templates dependencies, including webpack v4 changes. Config that is automatically provided by webpacks new "mode" flag has been removed.

pearofducks commented 6 years ago

"babel-loader": "^7.1.24"

Doesn't exist ;) 7.1.4 is newest from v7

https://www.npmjs.com/package/babel-loader?activeTab=versions

pearofducks commented 6 years ago

webpack.common.js uses var for imports, the others {dev | prod} use const

timwis commented 6 years ago

One of the reasons I still prefer webpack-simple and recommend it to newer Vue.js devs is that there's only a single webpack config file in my project's code to grok. Is there a strong reason to split this into 3 files?

robcresswell commented 6 years ago

@timwis Hey Tim, thanks for commenting. It's mostly just a separation of concerns. Rather than having one huge webpack config file with conditions spread throughout, you now have isolated files that rely on webpacks new mode flag. These files can then be read by new people as "this always happens", "this happens in development" and "this happens in production". This is used in most of the webpack documentation for v4, too.

Personally I think that consistency with upstream advice, as well as a clear separation between development config and production config, makes it worthwhile adopting the change.

pearofducks commented 6 years ago

I'd also advocate for the separate files because:

timwis commented 6 years ago

Totally valid points in terms of what's more scaleable and ideal, but I think that's what the regular webpack template is for. The webpack-simple template is described as:

A simple Vue 2.0 Webpack & vue-loader setup for quick prototyping.

I've introduced Vue to several developers who are new to JavaScript framework and are coming from a jQuery / WordPress background. They've never used Webpack and the idea of 3 config files for bundling would have been more intimidating. Assuming this is the template we recommend to beginners, I would advocate that we keep it as simple as possible while enabling all features of single-file components.

I think this may be an example of the trade-offs between abstraction and understandability. To quote TC++PL4:

All problems in computer science can be solved by another level of indirection, except for the problem of too many layers of indirection. – David J. Wheeler

robcresswell commented 6 years ago

I wrote a response but it's just turning into a battle of opinions and its taking more of my time than I want to invest. I'll maintain a fork in my own repos. Thanks all.

timwis commented 6 years ago

Oh no! Rob, I certainly didn't mean to make it feel like a battle. And it's not like I've contributed anything other than unsolicited opinions to this project. I would benefit from the webpack upgrade you were working on and was looking forward to that being merged. I'm just worried about the PR also increasing the config footprint because it might intimidate newer developers. My goal was to make sure that concern was fully voiced so that the maintainers (which I actually assumed you were one of) could make the decision. But I can see how it could feel like a battle of opinions so I apologise for that. I really hope I haven't led you to hesitate before making future contributions to this community. I really appreciate you taking the time to submit a pull request.