npm i --save-dev webpack-metrics
yarn add --dev webpack-metrics
Import webpack-metrics
into your Webpack configuration file:
const WebpackMetrics = require('webpack-metrics');
Instantiate new WebpackMetrics(...)
class within Webpack's plugin configuration array:
{
"plugins": [
new WebpackMetrics()
]
}
new WebpackMetrics({
...options...
})
Option | Types | Description | Default |
---|---|---|---|
--- |
--- | --- | --- |
new WebpackMetrics({
})
Webpack Metrics comes with a number of tests found under /tests
.
These are here to help you better understand the expectations of each option we covered above.
Simply run npm run test
or yarn test
from the root of the plugin to run all tests. Running a test will produce a /dist/[test]
directories.
If you would like to change a test, update the root package.json file's test
script to use any of the /test/*.test.config.js
files.