Skip to content

hulk4fe/entryPlugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

entry-webpack-plugin

entry webpack plugin 本插件目的是帮助程序根据环境自动切分webpack的入口

安装

npm install --save-dev entry-webpack-plugin

使用

package.json

  scripts: {
    "build:debug": "webpack --config webpack.config.js --debug",
    "build": "webpack --config webpack.config.js"
  }

webpack.config.js

  var EntryWebpackPlugin = require('entry-webpack-plugin'); 
  const argv = require('yargs')
      .describe('debug', 'debug 环境') // use 'webpack --debug'
      .argv;
  module.exports = {
    plugins: [
      new EntryWebpackPlugin({enable: argv.debug, filter: ['vendor'], entry: "entry.js"})
    ]
  } 

参数说明

/**
 * entry-webpack-plugin是控制打包entry的插件
 * @param {Object} options 
 * @param {Boolean} options.enable 是否启用功能
 * @param {Array} options.filter 需要过滤的entry
 * @param {string} options.entry 需要新增的自定义entry路径
 * @author me-hotel
 */

About

webpack entry plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published