Skip to content

Latest commit

 

History

History
110 lines (81 loc) · 4 KB

README_zh-CN.md

File metadata and controls

110 lines (81 loc) · 4 KB

@lzwme/feps-webpack-plugin

@lzwme/feps-webpack-plugin

NPM version node version npm download GitHub issues GitHub forks GitHub stars minzipped size

函数执行性能统计插件。

此插件用于函数执行性能统计,通过注入统计代码的方式计算执行耗时发现慢函数。

Getting Started

首先在项目中安装插件依赖。示例:

pnpm install -D @lzwme/feps-webpack-plugin

然后在 webpack 配置中添加插件配置。示例:

webpack.config.js

// webpack.config.js

const path = require('path');
const webpack = require('webpack');
const FEPSPlugin = require('@lzwme/feps-webpack-plugin');

module.exports = {
  plugins: [
    new FEPSPlugin({
      // debug: true,
      // disabled: false,
      rootDir: __dirname,
      timeLimit: 50,
      logger: 'console.warn', // 'globalThis.logger.report',
      include: [/\.(tsx?|jsx?)$/],
      exclude: ['node_modules', /\.ignore\./],
      excludeNodeType: [],
    }),
  ],
};

Options

Name Type Default Description
debug {boolean} false debug for print details info
disabled {boolean} false Disable the plugin
rootDir {String} process.cwd() Project root directory
logger {String} console.warn 指定打印慢函数日志信息的全局方法
timeLimit {Number} 50 慢函数执行耗时阈值。
执行时间大于该值则会调用 options.logger 指定的全局方法
include {(String | RegExp)[]} [/(jsx?|tsx?)$/] Specifies a list of patterns that match files to be included in compilation
exclude {(String | RegExp)[]} ['node_modules'] Specifies a list of patterns that match files to be excluded from compilation
excludeNodeType {AnyNode[]} [] Specifies a list of ast node types that to be excluded

Examples

!yarn-dev.png

!webpack5-example.png

Development

git clone https://github.com/lzwme/feps-webpack-plugin.git
pnpm install

# start for examples/webpack5-example
pnpm run dev
# enable cache by filesystem
pnpm run dev --cache
# first delete the dist and cache directories
pnpm run dev --reset

License

@lzwme/feps-webpack-plugin is released under the MIT license.

该插件由志文工作室开发和维护。