// webpack.config.js
const ImageminPlugin = require('imagemin-webpack-plugin').default
module.exports = {
plugins: [
new ImageminPlugin({
pngquant: {
quality: '50' // unreasonably low value to see it works
}
})
]
}
// angular.json
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"path": "./webpack.config.js"
},
}
},
"serve": {
"builder": "@angular-builders/custom-webpack:dev-server",
"options": {
"customWebpackConfig": {
"path": "./webpack.config.js"
},
}
}
}
这在开发中运行良好,但是当我在生产中运行应用程序时:
"start:prod": "angular-http-server --path dist/event-io -p $PORT",
"build:prod": "ng build --prod --stats-json",
即使实际加载了插件,图像也具有其原始大小。
订单有问题吗?