-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathwebpack.common.js
More file actions
44 lines (40 loc) · 1.16 KB
/
webpack.common.js
File metadata and controls
44 lines (40 loc) · 1.16 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
const helpers = require("./helpers");
const { DefinePlugin } = require("webpack");
const rules = {
html: {
test: /\.html$/,
loader: "raw-loader",
exclude: [/node_modules/, helpers.root("src/app/index.html")],
},
json: {
type: "javascript/auto",
test: /\.json$/,
loader: "raw-loader",
exclude: [/node_modules/],
},
file: {
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file-loader",
},
font: {
test: /\.woff(2)?(\?v=\d+\.\d+\.\d+)?$/,
loader: "url-loader?limit=10000&mimetype=application/font-woff",
},
};
const commonRules = [
rules.html, rules.json, rules.file, rules.font,
];
exports.defineEnv = function(env) {
return new DefinePlugin({
"ENV": JSON.stringify(env),
"process.env": {
"ENV": JSON.stringify(env),
"NODE_ENV": JSON.stringify(env),
"RENDERER": JSON.stringify(true),
"HOT": helpers.hasProcessFlag("hot"),
"BE_ENABLE_A11Y_TESTING": process.env.BE_ENABLE_A11Y_TESTING,
},
});
};
exports.rules = rules;
exports.commonRules = commonRules;