-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
63 lines (61 loc) · 1.86 KB
/
webpack.config.js
File metadata and controls
63 lines (61 loc) · 1.86 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
/**
* Created by kib357 on 30/10/15.
*/
const webpack = require("webpack");
const path = require("path");
const APP_DIR = path.resolve(__dirname, "./src");
console.log("Loading webpack config...");
module.exports = (env) => {
const REMOTEDIR = env && env.REMOTEDIR ? path.resolve(env.REMOTEDIR) : false;
return {
mode: "production",
entry: ["whatwg-fetch", "./src/js/app.js"],
devtool: "source-map",
output: {
path: path.resolve("release"),
filename: "bundle.js",
chunkFilename: "[name].js",
publicPath: "/assets/blank/js/",
},
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.DefinePlugin({
REMOTEDIR: JSON.stringify(REMOTEDIR),
}),
],
};
};