Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use this plugin in vue-cli3 #90

Open
jizai94 opened this issue Oct 11, 2019 · 4 comments
Open

how to use this plugin in vue-cli3 #90

jizai94 opened this issue Oct 11, 2019 · 4 comments

Comments

@jizai94
Copy link

jizai94 commented Oct 11, 2019

No description provided.

@AllenChinese
Copy link

you can do it like this:

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

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

@pengfeir
Copy link

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

@gottayan
Copy link

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

yeah same to me it does not take effect.

@joyerli
Copy link

joyerli commented Mar 27, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants