-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.karma.js
48 lines (46 loc) · 1.27 KB
/
webpack.config.karma.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
const path = require("path");
module.exports = new function(options) {
options = options || {};
return Object.assign(this, {
mode: "production",
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: [".ts", ".tsx", ".js"],
alias: {
"configcat-common/lib": "configcat-common/lib/esm"
}
},
devtool: "inline-source-map",
optimization: {
// This is a workaround necessary because source maps are broken by default in karma-webpack 5.0.0
// (see https://github.com/ryanclark/karma-webpack/issues/493#issuecomment-780411348)
splitChunks: false
},
module: {
rules: [
...(options.enableCoverage
? [{
test: /\.ts$/,
include: [path.resolve("src")],
use: {
loader: "@ephesoft/webpack.istanbul.loader",
options: { esModules: true },
},
enforce: "post"
}]
: []
),
// all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
{
test: /\.tsx?$/,
use: [{
loader: "ts-loader",
options: {
configFile: "tsconfig.karma.json"
}
}]
}
]
}
});
};