Entrypoint wrapper webpack plugin
Description
一款用于包装 Entry 配置的 Webpack 插件。
安装
npm i -D entrypoint-wrapper-webpack-plugin
用法
const EntryPoint = require('entrypoint-wrapper-webpack-plugin'); module.exports = { entry: { 'common': ['vue', 'vuex'], 'my/index': 'src/views/my/index.vue' }, plugins: [ new EntryPoint({ include: /.*\.vue$/, file: './default_index.js' // wrapper file }) ] }
const EntryPoint = require('entrypoint-wrapper-webpack-plugin'); module.exports = { entry: { 'common': ['vue', 'vuex'], 'my/index': 'src/views/my/index.vue' }, plugins: [ new EntryPoint({ include: /.*\.vue$/, // template string template: 'import Main from '<%= origin %>';Main.el = '#root';new Vue(Main)' }) ] }
const EntryPoint = require('entrypoint-wrapper-webpack-plugin'); module.exports = { entry: { 'common': ['vue', 'vuex'], 'my/index': 'src/views/my/index.vue' }, plugins: [ new EntryPoint({ include: /.*\.vue$/, // template function template: function(params){ return `import Main from '${params.origin}';Main.el = '#root';new Vue(Main)` } }) ] }
选项
姓名 | 类型 | 默认 | 描述 |
skipExistFiles |
{Boolean} |
false |
跳过现有文件 |
include |
{RegExp} |
/.*/ |
包含的文件 |
file |
{String} |
'' |
包装路径 |
template |
{Function,String} |
'' |
包装模板 |