Skip to content

When webpack option has externals property is array, plugin no work #81

@benleilei

Description

@benleilei

When webpack option has externals property is array, plugin no work.

in my file, load echarts

import echarts from 'echarts/lib/echarts';
import 'echarts/lib/chart/line';
import 'echarts/lib/chart/bar';
......

webpack option like

{
    externals: [/^echarts([a-zA-Z0-9\/]*)/],
    plugins: [
        new WebpackCdnPlugin({
            modules: [
                { name: 'axios', var: 'axios', path: 'axios.min.js' },
                { name: 'lodash', cdn: 'lodash.js', var: '_', path: 'lodash.min.js' },
                // { name: 'echarts', var: 'echarts', paths: 'echarts.min.js' } // it not work, chunk-vendors.js still has echarts library
                ......
            ],
            prod: true,
            publicPath: '/node_modules',
            prodUrl: ......
        })
    ]
}

build app, in chunk-vendors.js still has axios and lodash library.

  1. how to config plugin to echarts in cdn, not in chunk-vendors.js file?
  2. plugin and externals property is not at same time?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions