webpack-cdn-plugin
webpack-cdn-plugin copied to clipboard
When webpack option has externals property is array, plugin no work
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.
- how to config plugin to echarts in cdn, not in chunk-vendors.js file?
- plugin and externals property is not at same time?