Don’t use BundleAnalyzerPlugin in tests

nolan/hinaloe-test
Etienne Lemay 2017-08-17 10:31:32 -04:00
parent 4f9320a51f
commit 6d60239998
2 changed files with 22 additions and 11 deletions

View File

@ -62,7 +62,7 @@ module.exports = function(config) {
// Continuous Integration mode // Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits // if true, Karma captures browsers, runs the tests and exits
singleRun: false, singleRun: true,
// Concurrency level // Concurrency level
// how many browser should be started simultaneous // how many browser should be started simultaneous

View File

@ -6,7 +6,7 @@ var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlug
var PROD = process.env.NODE_ENV === 'production'; var PROD = process.env.NODE_ENV === 'production';
var TEST = process.env.NODE_ENV === 'test'; var TEST = process.env.NODE_ENV === 'test';
module.exports = { var config = {
entry: path.resolve('src/index.js'), entry: path.resolve('src/index.js'),
output: { output: {
path: path.resolve('dist'), path: path.resolve('dist'),
@ -15,14 +15,7 @@ module.exports = {
libraryTarget: 'umd', libraryTarget: 'umd',
}, },
externals: !TEST && [{ externals: [],
'react': {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
}],
module: { module: {
loaders: [ loaders: [
@ -53,8 +46,26 @@ module.exports = {
new webpack.DefinePlugin({ new webpack.DefinePlugin({
EMOJI_DATASOURCE_VERSION: `'${pack.devDependencies['emoji-datasource']}'`, EMOJI_DATASOURCE_VERSION: `'${pack.devDependencies['emoji-datasource']}'`,
}), }),
new BundleAnalyzerPlugin({ analyzerMode: 'static', openAnalyzer: false })
], ],
bail: true, bail: true,
} }
if (!TEST) {
config.externals = config.externals.concat([
{
'react': {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
},
])
config.plugins = config.plugins.concat([
new BundleAnalyzerPlugin({ analyzerMode: 'static', openAnalyzer: false }),
])
}
module.exports = config