-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.test.js
executable file
·43 lines (36 loc) · 1.18 KB
/
webpack.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// for test
//
var webpack = require('webpack');
var path = require('path');
var readConfig = require('read-config');
var staticRoot = path.join(__dirname, 'dist/static/');
var webpackConfig = require('./webpack.common.js')(staticRoot);
// webpackConfig.cache = false;
webpackConfig.plugins = webpackConfig.plugins.concat([
new webpack.DefinePlugin({
'typeof window': JSON.stringify("object")
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('test'),
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'test/common.js',
minChunks: function ({ resource }) {
return resource &&
resource.indexOf('node_modules') >= 0 &&
resource.match(/\.js$/);
}
})
]);
webpackConfig.externals = {
// 'cheerio': 'window',
// 'jsdom': 'window',
'react/addons': true,
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true
};
delete webpackConfig.entry;
// delete webpackConfig.output;
// console.log(webpackConfig.output);
webpackConfig.devtool = 'cheap-module-source-map';
module.exports = webpackConfig;