speed-measure-webpack-plugin icon indicating copy to clipboard operation
speed-measure-webpack-plugin copied to clipboard

how to use this plugin in vue-cli3

Open jizai94 opened this issue 5 years ago • 4 comments

jizai94 avatar Oct 11 '19 08:10 jizai94

you can do it like this:

const SpeedMeasurePlugin = require('speed-measure-webpack-plugin')
const smp = new SpeedMeasurePlugin()

module.exports = {
    ...,
    configureWebpack: smp.wrap({
        output: {
	    ...
        },
        plugins: [
    	   ...
        ]
    })
}

AllenChinese avatar Nov 29 '19 06:11 AllenChinese

@AllenChinese I follow your configuration but it does not take effect

pengfeir avatar Dec 25 '19 03:12 pengfeir

@AllenChinese I follow your configuration but it does not take effect

yeah same to me it does not take effect.

gottayan avatar Mar 24 '20 02:03 gottayan

I created a new vue-cli plug-in. The main content of the plug-in is:

const origin = api.service.resolveWebpackConfig.bind(api.service);
  api.service.resolveWebpackConfig = (...params) => {
    const config = origin(...params);
    const smp = new SpeedMeasurePlugin();
    return smp.wrap(config);
  };

By resetting 'api.service.resolvewebpackconfig', SMP wraps all webpack configurations

joyerli avatar Mar 27 '20 07:03 joyerli