-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathwebpack.dev.config.js
74 lines (70 loc) Β· 1.48 KB
/
webpack.dev.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
const path = require('path')
const webpack = require('webpack')
const defaultExclude = {
css: false,
images: false,
js: false,
ip: false,
}
const mode = 'development'
const ipInfoToken = JSON.stringify(process.env.IPINFO || 'not-yet-set')
const clientId = JSON.stringify(process.env.CLIENT_ID || 'not-yet-set')
const lokiHost = JSON.stringify(process.env.LOKI_HOST || 'loki.jorgelbg.me')
const excludeOptions = JSON.stringify(
process.env.WORKER_OPTIONS || defaultExclude,
)
const sessionHash = JSON.stringify(
process.env.FINGERPRINT || 'finger-print-token',
)
console.log({
ipInfoToken,
clientId,
lokiHost,
excludeOptions,
fingerprintHash: sessionHash,
})
module.exports = {
output: {
filename: `worker.${mode}.js`,
path: path.join(__dirname, 'dist'),
},
devtool: 'none',
mode,
plugins: [
new webpack.DefinePlugin({
IPINFO: ipInfoToken,
CLIENT_ID: clientId,
LOKI_HOST: lokiHost,
OPTIONS: `'${excludeOptions}'`,
FINGERPRINT: sessionHash,
}),
],
resolve: {
extensions: ['.ts', '.tsx', '.js'],
plugins: [],
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
{
test: /\.ya?ml$/,
use: [
{
loader: '@friends-of-js/yaml-loader',
options: { useNodeEnv: false },
},
],
},
],
},
node: {
fs: 'empty',
net: 'empty',
},
}