-
Notifications
You must be signed in to change notification settings - Fork 10
/
webpack.config.babel.js
65 lines (57 loc) · 1.39 KB
/
webpack.config.babel.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
'use strict';
const Path = require('path');
const webpack = require('webpack');
const webpackConfig = require('@silverstripe/webpack-config');
const {
resolveJS,
externalJS,
moduleJS,
pluginJS,
moduleCSS,
pluginCSS,
} = webpackConfig;
const ENV = process.env.NODE_ENV;
const PATHS = {
ROOT: Path.resolve(),
MODULES: 'node_modules',
FILES_PATH: '../',
THIRDPARTY: 'thirdparty',
SRC: Path.resolve('client/src'),
};
const config = {
entry: {
bundle: Path.join(__dirname, '/client/src/bundles/bundle')
},
output: {
path: Path.join(__dirname, '/client/dist'),
filename: '[name].min.js'
},
resolve: resolveJS(ENV, PATHS),
externals: externalJS(ENV, PATHS),
//module: moduleJS(ENV, PATHS),
plugins: pluginJS(ENV, PATHS),
/*
resolve: {
extensions: ["", ".webpack.js", ".jsx", ".js"]
},*/
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
]
};
//module.exports = config;
module.exports = (process.env.WEBPACK_CHILD)
? config.find((entry) => entry.name === process.env.WEBPACK_CHILD)
: module.exports = config;