-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.cjs
More file actions
73 lines (72 loc) · 2.03 KB
/
webpack.config.cjs
File metadata and controls
73 lines (72 loc) · 2.03 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
const path = require('path');
const webpack = require('webpack');
const packageJson = require('./package.json');
const DOMMetadataPlugin = require("./extract-dom-classes");
module.exports = {
mode: 'production',
devtool: 'source-map',
entry: './src/index.ts',
output: {
filename: 'fdo-sdk.bundle.js',
path: path.resolve(__dirname, 'dist'),
clean: true,
library: {
type: 'commonjs2',
},
publicPath: '',
},
optimization: {
minimize: false,
usedExports: false,
concatenateModules: false,
},
performance: {
// SDK is shipped as a Node/Electron library bundle, not a web entrypoint.
// Webpack size hints are not meaningful for this artifact.
hints: false,
},
resolve: {
extensions: ['.ts', '.js', '.json'],
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: 'ts-loader'
}
]
},
plugins: [
new webpack.DefinePlugin({
__FDO_SDK_PACKAGE_VERSION__: JSON.stringify(packageJson.version),
}),
new DOMMetadataPlugin({
srcDir: "src",
outFile: "dom-metadata.json",
})
],
externals: [
({ request }, callback) => {
if (request && request.startsWith("node:")) {
return callback(null, `commonjs ${request}`);
}
return callback();
},
{
electron: "commonjs electron",
fs: "commonjs fs",
path: "commonjs path",
os: "commonjs os",
https: "commonjs https",
http: "commonjs http",
zlib: "commonjs zlib",
util: "commonjs util",
stream: "commonjs stream",
buffer: "commonjs buffer",
crypto: "commonjs crypto",
"worker_threads": "commonjs worker_threads",
"child_process": "commonjs child_process"
}
]
};