简体   繁体   English

在vue.config.js中使用webpack-chain做webpack配置,那么speed-measure-webpack-plugin插件如何使用呢?

[英]Use webpack-chain to do webpack configuration in vue.config.js, so how to use speed-measure-webpack-plugin plugin?

This is the configuration file of my vue-cli3这是我的 vue-cli3 的配置文件

vue.config.js: vue.config.js:

const path = require('path')
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
const smp = new SpeedMeasurePlugin();

module.exports = {
  publicPath: './',
  lintOnSave: true, 
  chainWebpack(config) {
    config.devServer
      .port(8089)
      .open(true)
      .disableHostCheck(true)

    config.when(process.env.NODE_ENV !== 'development', config => {

      config  
        .plugin('gzip')
        .use(CompressionWebpackPlugin, [{
          algorithm: 'gzip',  
          test: new RegExp('\\.(' + ['js', 'css'].join('|') + ')$'),
          threshold: 8192,
          minRatio: 0.8,
          cache: true
        }])
    })
  }
}

According to the configuration of speed-measure-webpack-plugin, all the plugins are wrapped, but if you use webpack-chain, can you not use this plugin?根据speed-measure-webpack-plugin的配置,所有的插件都被包装了,但是如果使用webpack-chain,是不是可以不用这个插件呢?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Vue/Webpack/Typescript - 如何使用 jQuery 插件 - Vue/Webpack/Typescript - How to use jQuery Plugin 如何使用 webpack-chain 向 ts-loader 添加 appendTsSuffixTo 选项? - How to use webpack-chain to add appendTsSuffixTo options to ts-loader? 在Webpack配置的“插件”或“最小化器”部分中使用uglifyjs-webpack-plugin? - Use uglifyjs-webpack-plugin in `plugins` or in `minimizer` section of Webpack config? 如何在 VueCLI 3 中全局获取`webpack.config.js` 或 `vue.config.js` 文件数据 - How to get `webpack.config.js` or `vue.config.js` file data globally in VueCLI 3 如何使用webpack.config.js自定义配置? - How to use webpack.config.js custom configuration? 如何在 webpack 5 copy-webpack-plugin 中使用展平设置 - How to use flatten setting in webpack 5 copy-webpack-plugin Webpack:我们如何*有条件地*使用插件? - Webpack: How can we *conditionally* use a plugin? 如何将 webpack 自定义配置与 react js 一起使用? - How to use webpack custom config with react js? 如何将适用于 webpack.config.js 的指令/代码翻译成 vue.config.js 文件? - How can I translate the instructions/code that would work on the webpack.config.js to the vue.config.js file? 如何将 Webpack 4 插件转换为 Webpack 5 - How to convert Webpack 4 plugin to Webpack 5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM