webpack-custom-var-library-name-plugin

2019-04-15 admin

webpack-custom-var-library-name-plugin是什么

什么是webpack-custom-var-library-name-plugin,A WebPack hack plugin to allow to set a different module name to the var libraryTarget and the AMD/CommonJS when using libraryTarget:'umd'.

webpack-custom-var-library-name-plugin使用教程帮助文档

CustomVarLibraryNamePlugin

A WebPack (hack) plugin to allow to set a different module name to the var libraryTarget and the AMD/CommonJS when using libraryTarget:'umd'.

Install

$ npm i --save-dev webpack-custom-var-library-name-plugin

Usage

var CustomVarLibraryNamePlugin = require('webpack-custom-var-library-name-plugin');

var webpackConfig = {
    ...
    output: {
        path: path.join(__dirname, '../build'),
        filename: '[name].min.js',
        library: 'some-name',
        libraryTarget: 'umd',
        umdNamedDefine: true
    },
    ...
    plugins: [
        ...
        new CustomVarLibraryNamePlugin({
          name: 'someName'
        }),
        ...
    ],
    ...
};

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-61806.html

文章标题:webpack-custom-var-library-name-plugin

回到顶部