forked from tinper-bee/bee-switch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.dev.js
More file actions
71 lines (66 loc) · 1.98 KB
/
webpack.dev.js
File metadata and controls
71 lines (66 loc) · 1.98 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
var fs = require('fs');
var webpack = require('webpack');
function getNeouiReactModuleAlias() {
var alias = {};
if (!fs.existsSync('./neouiReact')) return alias;
var modules = fs.readdirSync('./neouiReact');
modules.forEach(function (name) {
alias[name] = [process.cwd(), 'neouiReact', name, 'src'].join('/');
});
return alias;
}
module.exports = {
cache: false,
entry: {
demo: './demo/index'
},
output: {
path: './dist',
filename: "[name].js",
sourceMapFilename: "[name].js.map"
},
devtool: '#source-map',
module: {
loaders: [
{
test: /\.js(x)*$/,
exclude: function (path) {
var isNpmModule = !!path.match(/node_modules/);
var isNeouiReact = !!path.match(/node_modules[\/\\](@ali[\/\\])?neouiReact/);
return isNpmModule & !isNeouiReact;
},
loader: 'es3ify-loader'
},
{
test: /\.js(x)*$/,
exclude: function (path) {
var isNpmModule = !!path.match(/node_modules/);
var isNeouiReact = !!path.match(/node_modules[\/\\](@ali[\/\\])?neouiReact/);
return isNpmModule & !isNeouiReact;
},
loader: 'babel-loader',
query: {
presets: ['react', 'es2015-loose', 'stage-1'],
plugins: [
'add-module-exports'
]
}
}
]
},
resolve: {
alias: getNeouiReactModuleAlias()
},
externals: {
react: 'var React',
'react-dom': 'var ReactDOM'
},
plugins: [
new webpack.DefinePlugin({
__LOCAL__: true, // 本地环境
__DEV__: true, // 日常环境
__PRO__: false // 生产环境
}),
new webpack.optimize.DedupePlugin()
]
};