vue-cli-plugin-multi-compiler

0.1.0 • Public • Published

vue-cli-plugin-multi-compiler

Vue CLI 3 plugin to add support for webpack multi-compiler mode

Getting Started

vue add multi-compiler

Configure

This plugin provides a option (configureMultiCompilerWebpack) in vue.config.js to tweak original vue cli webpack config into multiple configs.

You can use either a function or an array:

function usage

module.exports = {
  pluginOptions: {
    configureMultiCompilerWebpack: webpackConfig => {
      // `webpackConfig` here is the one resolved by vue cli.
      // (**after** executing `configureWebpack` and `chainWebpack`)
      const cloneDeep = require('lodash.clonedeep')
      const mainConfig = cloneDeep(webpackConfig)
      const appConfig = cloneDeep(webpackConfig)
 
      mainConfig.entry = {
        main: './src/main.js'
      }
      appConfig.entry = {
        app: './src/app.js'
      }
 
      // return an array to invoke webpack multi-compiler mode
      return [mainConfig, appConfig]
    }
  }
}

array usage

module.exports = {
  pluginOptions: {
    configureMultiCompilerWebpack: [
      // configurations here will be merged with original webpack config
      // by `webpack-merge`
      {
        entry: {
          main: './src/main.js'
        }
      },
      {
        entry: {
          app: './src/app.js'
        }
      }
    ]
  }
}

/vue-cli-plugin-multi-compiler/

    Package Sidebar

    Install

    npm i vue-cli-plugin-multi-compiler

    Weekly Downloads

    345

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    3.49 kB

    Total Files

    4

    Last publish

    Collaborators

    • jingkai.zhao