-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwebpack.config.js
64 lines (58 loc) · 1.39 KB
/
webpack.config.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const webpack = require('webpack');
const path = require('path');
module.exports = {
entry: {
uxcore: './index.js',
builder: './theme/builder/index.js',
setting: './theme/js/setting.js',
},
resolve: {
extensions: ['', '.js', '.jsx'],
},
output: {
path: path.join(process.cwd(), 'theme/static'),
filename: '[name].js',
libraryTarget: 'umd',
},
externals: {
react: 'var React',
rangy: 'var rangy',
'react-dom': 'var ReactDOM',
},
resolveLoader: {
root: path.join(__dirname, 'node_modules'),
},
module: {
loaders: [
{
test: /\.js(x)*$/,
// node_modules目录下都不需要过babel了
exclude(modulePath) {
const isNpmModule = !!modulePath.match(/node_modules/);
return isNpmModule;
},
loader: 'babel-loader',
query: {
presets: ['react', 'es2015-ie', 'stage-0'],
plugins: [
'transform-es3-member-expression-literals',
'transform-es3-property-literals',
'add-module-exports',
],
cacheDirectory: false,
},
}, {
test: /\.json$/,
loader: 'json',
}, {
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url?limit=10000&minetype=image/svg+xml',
},
],
},
plugins: [
new webpack.SourceMapDevToolPlugin({
columns: false,
}),
],
};