forked from TerriaJS/terriajs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.make.js
79 lines (75 loc) · 2.03 KB
/
webpack.config.make.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
var glob = require("glob-all");
var configureWebpack = require("./configureWebpack");
var path = require("path");
var MiniCssExtractPlugin = require("mini-css-extract-plugin");
//var testGlob = ['./test/**/*.js', './test/**/*.jsx', '!./test/Utility/*.js'];
var testGlob = [
"./test/SpecMain.ts",
"./test/**/*Spec.ts",
"./test/**/*Spec.tsx",
"./test/Models/Experiment.ts"
];
console.log(glob.sync(testGlob));
module.exports = function (hot, dev) {
const terriaJSBasePath = path.resolve(__dirname, "../");
var config = {
mode: dev ? "development" : "production",
entry: glob.sync(testGlob),
output: {
path: path.resolve(__dirname, "..", "wwwroot", "build"),
filename: "TerriaJS-specs.js",
publicPath: "build/"
},
// devtool: 'source-map',
// Use eval cheap module source map for quicker incremental tests
devtool: dev ? "eval-cheap-module-source-map" : "source-map",
module: {
rules: [
{
// Don't let jasmine-ajax detect require and import jasmine-core, because we bring
// in Jasmine via a script tag instead.
test: require.resolve("jasmine-ajax"),
loader: "imports-loader?require=>false"
}
// {
// test: /\.(ts|js)x?$/,
// include: [path.resolve(terriaJSBasePath, "lib")],
// use: {
// loader: "istanbul-instrumenter-loader"
// },
// enforce: "post"
// }
]
},
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"]
}
};
config.plugins = [
new MiniCssExtractPlugin({
filename: "nationalmap.css",
disable: false,
ignoreOrder: true
})
];
return configureWebpack(
terriaJSBasePath,
config,
dev || hot,
hot,
MiniCssExtractPlugin,
true
);
};