-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.vendor.dll.config.js
62 lines (56 loc) · 1.81 KB
/
webpack.vendor.dll.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
/* eslint-disable import/unambiguous */
const path = require("path");
const webpack = require("webpack");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const createRules = require("./build/rules.js");
const { extensions } = require("./build/resolve.js");
function createConfigForEnvironment(environment) {
const PROD = environment === "production";
const result = {
mode: environment,
entry: {
vendor: [
"@babel/polyfill",
"whatwg-fetch",
"react",
"react-dom",
"react-helmet",
"react-draggable",
"react-router-dom",
"react-router",
"prop-types",
"redux",
"redux-thunk",
"decimal.js",
"./src/Commons/ui/index",
"moment",
"memoizee",
],
},
output: {
path: path.join(__dirname, "prebuild", environment),
publicPath: "",
filename: PROD ? "[name].[hash].js" : "[name].js",
library: "vendor",
},
module: {
rules: createRules(environment),
},
resolve: {
extensions: extensions,
},
plugins: [
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en/),
new webpack.DllPlugin({
name: "vendor",
path: `prebuild/${environment}/vendor-manifest.json`,
}),
new webpack.DefinePlugin({}),
new MiniCssExtractPlugin({
filename: "[name].[hash].css",
}),
],
};
return result;
}
module.exports = [createConfigForEnvironment("production"), createConfigForEnvironment("development")];