Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
benleilei opened this issue Nov 3, 2020 · 0 comments
Open

Comments

@benleilei
Copy link

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?
toshiyuki-rs added a commit to toshiyuki-rs/webpack-cdn-plugin that referenced this issue Dec 5, 2021
This improvement fixes shirotech#81

It was caused by overwriting externals configuration without checking.
toshiyuki-rs added a commit to toshiyuki-rs/webpack-cdn-plugin that referenced this issue Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant