Просмотр исходного кода

esbuild: use HTTPS

customisations
alemart 7 месяцев назад
Родитель
Сommit
d56ed3e3cd
2 измененных файлов: 6 добавлений и 1 удалений
  1. 2
    0
      .gitignore
  2. 4
    1
      esbuild.mjs

+ 2
- 0
.gitignore Просмотреть файл

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

+ 4
- 1
esbuild.mjs Просмотреть файл

@@ -1,8 +1,9 @@
1 1
 import * as esbuild from 'esbuild';
2
+import path from 'path';
2 3
 import { readFile } from 'fs/promises';
3 4
 
4 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 7
 const pack = JSON.parse(json);
7 8
 const production = (argv.indexOf('--dev') < 0);
8 9
 const minify = (argv.indexOf('--minify') >= 0);
@@ -44,6 +45,8 @@ await ctx.serve({
44 45
     host: '0.0.0.0',
45 46
     port: 8000,
46 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 52
 function generateBanner()

Загрузка…
Отмена
Сохранить