-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
75 lines (72 loc) · 1.81 KB
/
webpack.config.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
const path = require("path");
const ReplaceBundleStringPlugin = require('replace-bundle-webpack-plugin');
/**
* See: https://stackoverflow.com/a/72219174/1288184
* The MD4 algorithm is not available anymore in Node.js 17+ (because of library SSL 3).
* In that case, silently replace MD4 by the MD5 algorithm.
*/
const crypto = require('crypto');
try {
crypto.createHash('md4');
} catch (e) {
console.warn('Crypto "MD4" is not supported anymore by this Node.js version');
const origCreateHash = crypto.createHash;
crypto.createHash = (alg, opts) => {
return origCreateHash(alg === 'md4' ? 'md5' : alg, opts);
};
}
module.exports = {
mode: "development",
entry: {
shellui: "./src/shellui.ts",
"Base.dashboard": "./src/dashboards/base-dashboard/Base.dashboard.ts",
/**
* #TEMPLATED_TODO - Change this to use your own dashboard(s).
*/
"Sample.dashboard": "./src/dashboards/sample-dashboard/Sample.dashboard.tsx",
},
devtool: "cheap-source-map",
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
alias: {
mocha: "mocha/mocha.js",
}
},
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "dist")
},
externals: {
MFiles: "MFiles",
ShellUIModule: "ShellUIModule",
MFilesDashboard: "window"
},
plugins: [
// es6-promise polyfill compile has Promise.prototype.catch/finally which doesn't work with Desktop
new ReplaceBundleStringPlugin([{
partten: /Promise.prototype.catch /g,
replacement: function () {
return 'Promise.prototype[\'catch\']';
}
},
{
partten: /Promise.prototype.finally /g,
replacement: function () {
return 'Promise.prototype[\'finally\']';
}
}])
]
};