Complete Vue.js 2 Web Development_ Practical guide to building end-to-end web development solutions with Vue.js 2

(singke) #1
Organize + Automate + Deploy = Webpack Chapter 16

new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
]
},
{
output: {
path: <whatever is your path>,
filename: 'myFilename.js'),
<other options you may have>
},
plugins: []
}
]

If you build your project now, you will have both a minified and a development file. You


can, of course, personalize your configurations to grow very different. For example, you
can add source maps in one and leave the other as is.


How it works...


We first created an array of objects that represent differences in the Webpack configuration.


We then mapped each piece of configuration into a larger, common configuration with the
help of webpack-merge. When we now call the npm run build command, both the


configurations run one after the other.


It's a common convention to postfix the name of the file with min to signal that the file is


minified and ready to be used in production.


Releasing your components to the public


At a certain point, there comes a moment when you want to give back to the community.


Maybe you built a "fart button" or maybe you built an automates stock options trader;
whatever it is that you've built, the JavaScript and Vue community will be happy to


welcome you. There is a big chunk of things to be done on the side of marketing and
licensing, but in this recipe you will concentrate on the more technical aspects.

Free download pdf