1.0.3 • Published 4 years ago

perfume-webpack-plugin v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

perfume-webpack-plugin

Build Status Coverage Status GitHub GitHub package.json version

A Webpack plugin to perfume.js

English | 简体中文

Installation:

First things first, install the module:

npm i perfume-webpack-plugin -D

Importing library

import PerfumeWebpackPlugin from 'perfume-webpack-plugin'

If using CommonJS import

const PerfumeWebpackPlugin = require('perfume-webpack-plugin').default

Example:

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,
    })
  ]
}

Default Options:

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,
};

License

MIT