-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
58 lines (55 loc) · 1.55 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
const uid2Entrypoint = './src/uid2Sdk.ts';
const euidEntrypoint = './src/euidSdk.ts';
const espEntryPointUid2 = './src/secureSignalUid2.ts';
const espEntryPointEuid = './src/secureSignalEuid.ts';
const espOutput = {
'uid2-secureSignals': {
import: espEntryPointUid2,
filename: `uid2SecureSignal.js`,
},
'euid-secureSignals': {
import: espEntryPointEuid,
filename: `euidSecureSignal.js`,
},
};
// n.b. if you add more outputs, the path is relative to the dist folder.
const getExampleOutputs = (env) => (!env.outputToExamples ? {} : espOutput);
module.exports = (env, argv) => {
const buildMode = argv.mode;
const isProduction = buildMode === 'production';
const prodSourceMaps = !!env.prodSourceMaps;
console.log(`Configuring webpack in ${buildMode} mode (isProduction === ${isProduction}).`);
return {
mode: buildMode,
devtool: prodSourceMaps ? 'source-map' : false,
entry: !env.espOnly
? {
'uid2-sdk': {
import: uid2Entrypoint,
filename: `uid2-sdk-${process.env.npm_package_version}.js`,
},
'euid-sdk': {
import: euidEntrypoint,
filename: `euid-sdk-${process.env.npm_package_version}.js`,
},
...getExampleOutputs(env),
}
: espOutput,
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
optimization: {
minimize: isProduction,
},
cache: false,
resolve: {
extensions: ['.ts'],
},
};
};