Skip to content

Commit 436817f

Browse files
committed
build(bin): fix webpack config, using 'config.externals'
1 parent d921cbc commit 436817f

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

build/bin.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const webpack = require('webpack')
1212
const webpackConfig = require(path.join(process.cwd(), 'webpack.config'))
1313
// handle Webpack output object and plugins
1414
const webpackOutput = { ...webpackConfig.output }
15-
const webpackPlugins = (webpackConfig.plugins && webpackConfig.plugins.concat()) || []
1615

1716
const fatalError = err => {
1817
if (err) {
@@ -39,22 +38,18 @@ const webpackConfigList = []
3938
}
4039
}
4140

42-
// setup Webpack plugins by output type
41+
// edit Webpack config by output type
4342
switch (outputType) {
4443
case '.bundle':
4544
// dependencies and polyfills
4645
break
4746
case '.polyfill':
4847
// lib and polyfills
49-
config.plugins = webpackPlugins.concat([
50-
new webpack.IgnorePlugin(/(@ecomplus\/utils|axios)/)
51-
])
48+
config.externals = /^(@ecomplus\/utils|axios)/i
5249
break
5350
default:
5451
// standalone lib output
55-
config.plugins = webpackPlugins.concat([
56-
new webpack.IgnorePlugin(/(@babel\/runtime|@ecomplus\/utils|axios|core-js)/)
57-
])
52+
config.externals = /^(@babel\/runtime|@ecomplus\/utils|axios|core-js)/i
5853
}
5954
webpackConfigList.push(config)
6055
})

0 commit comments

Comments
 (0)