A Webpack plugin to perfume.js
English | 简体中文
First things first, install the module:
npm i perfume-webpack-plugin -D
import PerfumeWebpackPlugin from 'perfume-webpack-plugin'
const PerfumeWebpackPlugin = require('perfume-webpack-plugin').default
const apiKey = 'xxx'
module.exports = {
plugins: [
new PerfumeWebpackPlugin({
entry: /app\.js$/,
fps: true,
dataConsumption: true,
resourceTiming: true,
cumulativeLayoutShift: true,
isMerge: true,
reportUrl: `https://example.com/report?apiKey=${apiKey}`,
ignoreResource: [{ key: 'name', value: '/report' }],
logging: false,
})
]
}
const options = {
entry: /app\.js$/,
// Metrics
fps: false,
dataConsumption: false,
resourceTiming: false,
cumulativeLayoutShift: false,
// Analytics
tag: '',
reportUrl: '',
ignoreResource: [],
isMerge: false,
analyticsTracker: option => {},
// Logging
logPrefix: 'Perfume.js:',
logging: true,
maxMeasureTime: 15000,
};