0.0.2 • Published 4 years ago

multiple-js-entry-plugin v0.0.2

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

multiple-js-entry-plugin

webpack 插件,动态载入 js 入口文件,webpack >= 4.0.0

使用示例

const MultipleJsEntryPlugin = require('../../plugin/index.js');

new MultipleJsEntryPlugin({
    src: path.join(__dirname, '../src'),
    split: '-',
    level: 0,
    // 入口匹配 js 文件
    // entryFiles: '*/**/index.js',
    // 过滤条件
    // filter: (file) => {
    //     return true;
    // },
    // 文件路径 entry 格式化转化
    // 需要返回 entry name
    // format: (file) => {
    //     return entryName
    // },
})

参数说明

参数类型是否必传默认值说明
srcStringundefined动态匹配路径文件夹路径
splitString”-“转换间隔,例如路径 a/b/c 转换为 a-b-c
levelNumber0匹配目录层级,0表示所有层级
entryFilesString*/**/index.js动态匹配 js 规则
filterFunctionnull根据文件路径地址过滤规则方法
formatFunctionnull根据文件路径地址动态格式化 entry name 方法