|
|
5 日 前 | |
|---|---|---|
| .. | ||
| WrappedPlugin | 5 日 前 | |
| node_modules | 5 日 前 | |
| .travis.yml | 5 日 前 | |
| CONTRIBUTING.md | 5 日 前 | |
| LICENSE | 5 日 前 | |
| README.md | 5 日 前 | |
| colours.js | 5 日 前 | |
| index.js | 5 日 前 | |
| jest.config.js | 5 日 前 | |
| lerna.json | 5 日 前 | |
| loader.js | 5 日 前 | |
| logo.svg | 5 日 前 | |
| migration.md | 5 日 前 | |
| neutrino.js | 5 日 前 | |
| output.js | 5 日 前 | |
| package.json | 5 日 前 | |
| preview.png | 5 日 前 | |
| utils.js | 5 日 前 | |
| utils.test.js | 5 日 前 | |
Speed Measure Plugin
<div><sup><em>(for webpack)</em></sup></div>
The first step to optimising your webpack build speed, is to know where to focus your attention.
This plugin measures your webpack build speed, giving an output like this:
npm install --save-dev speed-measure-webpack-plugin
or
yarn add -D speed-measure-webpack-plugin
SMP requires at least Node v6. But otherwise, accepts all webpack versions (1, 2, 3, and 4).
Change your webpack config from
const webpackConfig = {
plugins: [
new MyPlugin(),
new MyOtherPlugin()
]
}
to
const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
const smp = new SpeedMeasurePlugin();
const webpackConfig = smp.wrap({
plugins: [
new MyPlugin(),
new MyOtherPlugin()
]
});
and you're done! SMP will now be printing timing output to the console by default.
Check out the examples folder for some more examples.
Pass these into the constructor, as an object:
const smp = new SpeedMeasurePlugin(options);
options.disableType: Boolean
Default: false
If truthy, this plugin does nothing at all.
{ disable: !process.env.MEASURE } allows opt-in measurements with MEASURE=true npm run build.
options.outputFormatType: String|Function
Default: "human"
Determines in what format this plugin prints its measurements
"json" - produces a JSON blob"human" - produces a human readable output"humanVerbose" - produces a more verbose version of the human readable outputoptions.outputTargetType: String|Function
Default: console.log
options.pluginNamesType: Object
Default: {}
By default, SMP derives plugin names through plugin.constructor.name. For some
plugins this doesn't work (or you may want to override this default). This option
takes an object of pluginName: PluginConstructor, e.g.
const uglify = new UglifyJSPlugin();
const smp = new SpeedMeasurePlugin({
pluginNames: {
customUglifyName: uglify
}
});
const webpackConfig = smp.wrap({
plugins: [
uglify
]
});
options.granularLoaderData (experimental)Type: Boolean
Default: false
By default, SMP measures loaders in groups. If truthy, this plugin will give per-loader timing information.
This flag is experimental. Some loaders will have inaccurate results:
thread-loader)file-loader)We will find solutions to these issues before removing the (experimental) flag on this option.
Contributors are welcome! 😊
Please check out the CONTRIBUTING.md.
SMP follows semver. If upgrading a major version, you can consult the migration guide.