forked from ob-f/OpenBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnowpack.config.js
42 lines (38 loc) · 988 Bytes
/
snowpack.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
const proxy = import('http2-proxy')
const dotenv = require('dotenv');
dotenv.config();
/** @type {import("snowpack").SnowpackUserConfig } */
module.exports = {
mount: {
"client": "/"
},
optimize: {
bundle: true,
minify: true,
target: 'es2018',
treeshake: true,
},
routes: [
{
src: '/ws',
upgrade: (req, socket, head) => {
const defaultWSHandler = (err, req, socket, head) => {
if (err) {
console.error('proxy error', err);
socket.destroy();
}
};
proxy.ws(
req,
socket,
head,
{
hostname: 'localhost',
port: 7071,
},
defaultWSHandler,
);
},
},
],
};