-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.test.js
64 lines (62 loc) · 1.53 KB
/
webpack.test.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
const webpack = require("webpack"),
{ merge } = require("webpack-merge"),
path = require("path"),
{ htmlRule, config } = require("./webpack.common");
module.exports = merge(config, {
module: {
rules: [
{
test: /\.css$/v,
loader: "ignore-loader",
},
htmlRule,
],
},
resolve: {
alias: {
"~": [path.resolve(__dirname, "src")],
},
fallback: {
"process/browser": require.resolve("process/browser.js"),
},
},
devtool: "inline-source-map",
plugins: [
new webpack.ProvidePlugin({
process: "process/browser",
}),
// For testing, remap all modules to their mock versions by default
new webpack.NormalModuleReplacementPlugin(
/^~\/components\/list$/v,
"~/mocks/list-mock",
),
new webpack.NormalModuleReplacementPlugin(
/^~\/components\/progressbar$/v,
"~/mocks/progressbar-mock",
),
new webpack.NormalModuleReplacementPlugin(
/^~\/components\/window$/v,
"~/mocks/window-mock",
),
new webpack.NormalModuleReplacementPlugin(
/~\/controllers\/application-controller/v,
"~/mocks/application-controller-mock",
),
new webpack.NormalModuleReplacementPlugin(
/^~\/models\/episode-model$/v,
"~/mocks/episode-model-mock",
),
new webpack.NormalModuleReplacementPlugin(
/^~\/models\/program-model$/v,
"~/mocks/program-model-mock",
),
new webpack.NormalModuleReplacementPlugin(
/^~\/models\/series-model$/v,
"~/mocks/series-model-mock",
),
new webpack.NormalModuleReplacementPlugin(
/^~\/services\/api-service$/v,
"~/mocks/api-service-mock",
),
],
});