Skip to content

Commit

Permalink
build(bin): fix webpack config, using 'config.externals'
Browse files Browse the repository at this point in the history
  • Loading branch information
leomp12 committed Jul 17, 2019
1 parent d921cbc commit 436817f
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions build/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const webpack = require('webpack')
const webpackConfig = require(path.join(process.cwd(), 'webpack.config'))
// handle Webpack output object and plugins
const webpackOutput = { ...webpackConfig.output }
const webpackPlugins = (webpackConfig.plugins && webpackConfig.plugins.concat()) || []

const fatalError = err => {
if (err) {
Expand All @@ -39,22 +38,18 @@ const webpackConfigList = []
}
}

// setup Webpack plugins by output type
// edit Webpack config by output type
switch (outputType) {
case '.bundle':
// dependencies and polyfills
break
case '.polyfill':
// lib and polyfills
config.plugins = webpackPlugins.concat([
new webpack.IgnorePlugin(/(@ecomplus\/utils|axios)/)
])
config.externals = /^(@ecomplus\/utils|axios)/i
break
default:
// standalone lib output
config.plugins = webpackPlugins.concat([
new webpack.IgnorePlugin(/(@babel\/runtime|@ecomplus\/utils|axios|core-js)/)
])
config.externals = /^(@babel\/runtime|@ecomplus\/utils|axios|core-js)/i
}
webpackConfigList.push(config)
})
Expand Down

0 comments on commit 436817f

Please sign in to comment.