瀏覽代碼

esbuild: use HTTPS

customisations
alemart 7 月之前
父節點
當前提交
d56ed3e3cd
共有 2 個檔案被更改,包括 6 行新增1 行删除
  1. 2
    0
      .gitignore
  2. 4
    1
      esbuild.mjs

+ 2
- 0
.gitignore 查看文件

21
 # mine
21
 # mine
22
 node_modules/*
22
 node_modules/*
23
 www/
23
 www/
24
+local-server.cert
25
+local-server.key
24
 site/
26
 site/
25
 docs/__pycache__/*
27
 docs/__pycache__/*
26
 demos/**/*.blend1
28
 demos/**/*.blend1

+ 4
- 1
esbuild.mjs 查看文件

1
 import * as esbuild from 'esbuild';
1
 import * as esbuild from 'esbuild';
2
+import path from 'path';
2
 import { readFile } from 'fs/promises';
3
 import { readFile } from 'fs/promises';
3
 
4
 
4
 const argv = process.argv.slice(2);
5
 const argv = process.argv.slice(2);
5
-const json = await readFile(new URL('package.json', import.meta.url));
6
+const json = await readFile(new URL('./package.json', import.meta.url), { encoding: 'utf8' });
6
 const pack = JSON.parse(json);
7
 const pack = JSON.parse(json);
7
 const production = (argv.indexOf('--dev') < 0);
8
 const production = (argv.indexOf('--dev') < 0);
8
 const minify = (argv.indexOf('--minify') >= 0);
9
 const minify = (argv.indexOf('--minify') >= 0);
44
     host: '0.0.0.0',
45
     host: '0.0.0.0',
45
     port: 8000,
46
     port: 8000,
46
     servedir: 'www',
47
     servedir: 'www',
48
+    keyfile: path.join(import.meta.dirname, 'local-server.key'),
49
+    certfile: path.join(import.meta.dirname, 'local-server.cert'),
47
 });
50
 });
48
 
51
 
49
 function generateBanner()
52
 function generateBanner()

Loading…
取消
儲存