-
Notifications
You must be signed in to change notification settings - Fork 13
/
webpack.config.js
72 lines (67 loc) · 1.57 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
65
66
67
68
69
70
71
72
/* eslint-disable require-jsdoc */
const path = require('path');
const globEntries = require('webpack-glob-entries');
const commonConf = options => ({
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
},
},
],
},
optimization: {
minimize: true,
},
watch: options.mode !== 'production',
devtool: options.mode !== 'production' ? 'source-map' : false,
devServer: {
port: 9005,
// webpack-dev-server client overrides sockjs-node location if host === '0.0.0.0'
// to the window.location and it breaks live reload
// if you want to make webpack-dev-server available from outside (e.g. to debug Android device)
// change it to 0.0.0.0
host: 'localhost',
disableHostCheck: true,
compress: true,
inline: true,
},
});
const pluginDependenciesConfig = {
entry: globEntries('./js/plugin-dependencies/*/*.js'),
output: {
path: path.resolve('./build'),
filename: '[name].js',
},
};
const frameworkConfig = {
entry: globEntries('./js/framework/**/*.js'),
output: {
path: path.resolve('./build/js/framework'),
filename: '[name].js',
},
};
const pluginsConfig = {
entry: globEntries('./js/plugins/**/*.js'),
output: {
path: path.resolve('./build/js/plugins'),
filename: '[name].js',
},
};
module.exports = (env, options) => [
{
...commonConf(options),
...pluginDependenciesConfig,
},
{
...commonConf(options),
...frameworkConfig,
},
{
...commonConf(options),
...pluginsConfig,
},
];