How to do it…

We'll start with a project with the official Webpack template. You can use your own, or you can spin up a new project with vue init webpack and install the dependencies with npm isntall.

Go inside the build directory. When you launch the npm run build command, you are effectively launching the build.js file in this directory.

If you examine the file, you will find something like this near the end:

webpack(webpackConfig, function (err, stats) {...})

This is equivalent to launching Webpack from the command line using the same configuration specified in the first argument, webpackConfig. To have a minified and non-minified file, we have to bring the webpackConfig to a common denominator, then we will specify only the differences ...

Get Vue.js 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.