-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.dev.js
More file actions
77 lines (75 loc) · 2.17 KB
/
webpack.config.dev.js
File metadata and controls
77 lines (75 loc) · 2.17 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
72
73
74
75
76
77
/**
* Created by kib357 on 30/10/15.
*/
const webpack = require("webpack");
const HOT_SERVER_URL = "http://localhost:2816/";
const path = require("path");
const APP_DIR = path.resolve(__dirname, "./src");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
console.log("Loading webpack config...");
const REMOTEDIR = process.env.REMOTEDIR ? path.resolve(process.env.REMOTEDIR) : false;
module.exports = {
mode: "development",
entry: [
"react-hot-loader/patch",
`webpack-hot-middleware/client?reload=true&path=${HOT_SERVER_URL}__webpack_hmr`,
"whatwg-fetch",
"./src/js/app.js",
],
devtool: "eval",
devServer: {
inline: true,
},
output: {
path: "/",
filename: "bundle.js",
chunkFilename: "[name].js",
publicPath: HOT_SERVER_URL,
},
resolve: {
modules: [
path.resolve(APP_DIR, "js"),
path.resolve(__dirname, "blank-js-core"),
path.resolve(__dirname, "src/lib"),
path.resolve(__dirname, "node_modules"),
"node_modules",
],
alias: {
constants: path.resolve(__dirname, "blank-js-core/constants.js"),
},
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
},
},
],
},
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: "vendors",
chunks: "initial",
},
},
},
},
plugins: [
new webpack.ContextReplacementPlugin(/moment[\\\/]locale$/, /^\.\/(en|ru)$/),
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
REMOTEDIR: JSON.stringify(REMOTEDIR),
}),
new BundleAnalyzerPlugin({
analyzerMode: "static",
reportFilename: path.resolve(__dirname, "release", "stats.html"),
openAnalyzer: false,
}),
],
};