Static GitHub Issues

[621] Way to minify all bundle js files?

prev: https://cn.nuxtjs.org has problem
next: auth0 example fails to generate

Hi,

I’m looking for a way to minify all bunfle js files on build. I couldn't figure what I’m missing here.

Here’s an example of what I tried (here with babili):

build: {
	extend (config, { isDev, isClient }) {
		if (!isDev) {
			config.devtool = false
			config.plugins.push(
				new BabiliPlugin({
					// options here
				}, {
					comments: false
				})
			)
		}
	}
}

The build is correctly made, but has no effect on the bundles files. Another try with uglifyjs:

build: {
	extend (config, { isDev, isClient }) {
		if (!isDev) {
			config.devtool = false
			config.plugins.push(
				new webpack.optimize.UglifyJsPlugin({
					parse: {
						strict: true
					},
					compress: {
						unsafe: true,
						warnings: false,
						drop_console:true
					},
					output: {
						comments: false,
						ascii_only: true
					},
					mangle: true
				})
			)
		}
	}
}

This is globally the last thing I need to get a good grade on PageSpeed: https://gtmetrix.com/reports/dev.emmanuelbeziat.com/OpP40maF

If anybody has a working example, it would surely help :) Thanks!

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c537">#c537</a>)</em></sub></div>