I have difficulties in minifying images. I read the docs about extending the Webpack configuration. However, this code does not do anything to my assets.
const imageminloader = require('imagemin-webpack').imageminloader
module.exports = {
...
build: {
extend (config, ctx) {
if (ctx.isDev && ctx.isClient) {
config.module.rules.push({
test: /\.(png|jpe?g|gif|svg)$/,
use: [{
loader: 'url-loader',
query: {
limit: 1000, // 1kB
name: 'img/[name].[hash:7].[ext]'
}
}, {
loader: 'imageminloader'
}]
})
}
}
}
...
}
After running nuxt generate
, the output does not produce any error and my assets remain untouched. Is there anything I misunderstand?
I also searched for a property in the generate.minify
object without success.
As for static files, I suppose they are completely unplugged from Webpack and there is no way to minify images with Nuxt.
Thank you for your help.
<!--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/c2286">#c2286</a>)</em></sub></div>