eynol / qiankun-dev-webpack-plugin

qiankun plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

qiankun-dev-webpack-plugin

English 中文

Modify your webpack configs to fit qiankun subapp development。

How to use

const QiankunDevPlugin = require("qiankun-dev-webpack-plugin");

module.exports = {
  // create a new instance to plugins array
  plugins: [new QiankunDevPlugin()]
};

Options

You can pass a hash of configuration options to qiankun-dev-webpack-plugin.

Name Type Default Description
appName {String} package.json's name Library namespace
entryRule (src: string) => boolean undefined declare entry tag controlled

What does it modified

  1. Set output.libraryTarget to umd modules
  2. Add an entry attribute to entry script tag when using HtmlWebpackPlugin (If you do not use HtmlWebpackPlugin or its inject option is false, you MUST config an entry attribute for the entry script yourself)
  3. Config devServer's header to handle CORS request and correct sourcemap url while process.env.NODE_ENV is set to development
  4. entry script will be controlled by entryRule function, see here

DIY modifications

  • Config devServer.host, to change host name
  • Config devServer.headers to allow cors custom headers
  • Config devServer.allowdHosts or devServer.disableHostCheck

About

qiankun plugin


Languages

Language:TypeScript 95.7%Language:JavaScript 4.3%