-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
40 lines (39 loc) · 1.06 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
const path = require('path');
const src = path.resolve('./src');
const dist = path.resolve('./dist');
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
module.exports = {
mode: "production",
entry: src + "/index.js",
output: {
library: "FormCapacitor",
libraryTarget: 'umd',
filename: "index.js",
path: dist,
globalObject: 'this',
hashFunction: "xxhash64" // Needed for node 18, which no longer allows old hash algos. Also required upgrading webpack to latest 5.54+ See. https://stackoverflow.com/a/73027407/15825770
},
externals: {
"react": "react",
"react-dom": "react-dom"
},
module: {
rules: [
{
test: /\.(jsx?)$/,
include: src,
use: "babel-loader",
sideEffects: false
}
]
},
optimization: {
minimize: true,
usedExports: true,
},
plugins: [
new NodePolyfillPlugin({
excludeAliases: ["console"]
})
]
};