This repository has been archived by the owner on Aug 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
73 lines (71 loc) · 1.85 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
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
function baseConfig({ devtool, filename }) {
return {
entry: './src/polyfill.ts',
target: ['web', 'es5'],
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader',
options: {
configFile: 'tsconfig.es5.json',
},
},
],
},
],
},
devtool,
resolve: {
extensions: ['.tsx', '.ts', '.js'],
fallback: {
// this allow to build the all in one bundle
// nodejs cannot use this bundle (the bundle depends on window)
// so no problem to break this module
buffer: false,
fs: false,
http: false,
https: false,
path: false,
process: false,
stream: false,
'node:fs': false,
'node:http': false,
'node:https': false,
'node:path': false,
'node:process': false,
'node:stream': false,
'node:stream/web': false,
},
},
externals: {
'node:fs': 'commonjs2 node:fs',
'node:http': 'commonjs2 node:fs',
'node:https': 'commonjs2 node:fs',
'node:path': 'commonjs2 node:fs',
'node:process': 'commonjs2 node:fs',
'node:stream': 'commonjs2 node:fs',
'node:stream/web': 'commonjs2 node:fs',
},
output: {
path: path.resolve(__dirname, 'lib'),
filename,
globalObject: 'window',
library: {
name: 'gladiaio_sdk',
type: 'umd',
umdNamedDefine: true,
},
libraryExport: 'default',
},
};
}
module.exports = [
baseConfig({ devtool: 'inline-source-map', filename: 'gladiaio-sdk.js' }),
baseConfig({ devtool: 'source-map', filename: 'gladiaio-sdk.min.js' }),
];