-
Notifications
You must be signed in to change notification settings - Fork 394
Expand file tree
/
Copy pathwebpack.config.make.js
More file actions
74 lines (68 loc) · 1.74 KB
/
webpack.config.make.js
File metadata and controls
74 lines (68 loc) · 1.74 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
64
65
66
67
68
69
70
71
72
73
74
/**
* Webpack config for building specs
*/
const glob = require("fast-glob");
const configureWebpack = require("./configureWebpack");
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const testGlob = [
"./test/SpecMain.ts",
"./test/**/*Spec.ts",
"./test/**/*Spec.tsx",
"./test/Models/Experiment.ts"
];
const files = glob.sync(testGlob);
console.log(files);
module.exports = function (devMode) {
const terriaJSBasePath = path.resolve(__dirname, "../");
// base config for specs
const config = {
mode: devMode ? "development" : "production",
entry: files,
output: {
path: path.resolve(__dirname, "..", "wwwroot", "build"),
filename: "TerriaJS-specs.js",
publicPath: "build/"
},
// Use eval cheap module source map for quicker incremental tests
devtool: devMode ? "eval-cheap-module-source-map" : "source-map",
devServer: {
stats: "minimal",
port: 3002,
contentBase: "wwwroot/"
},
externals: {
cheerio: "window",
"react/addons": true,
"react/lib/ExecutionEnvironment": true,
"react/lib/ReactContext": true
},
resolve: {
alias: {},
modules: ["node_modules"]
},
plugins: [
new MiniCssExtractPlugin({
ignoreOrder: true
})
],
module: {
rules: [
// handle imports of text fixtures from specs
{
test: /\.(csv|xml)$/i,
include: [path.resolve(terriaJSBasePath, "wwwroot", "test")],
type: "asset/source"
}
]
}
};
const jsExtraPaths = [path.resolve(terriaJSBasePath, "test")];
return configureWebpack({
terriaJSBasePath,
jsExtraPaths,
config,
devMode,
MiniCssExtractPlugin
});
};