浏览代码

Optionally set the port number of the dev server using an environment variable

customisations
alemart 1 个月前
父节点
当前提交
0557ebe9c2
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1
    1
      esbuild.mjs

+ 1
- 1
esbuild.mjs 查看文件

42
 await ctx.watch();
42
 await ctx.watch();
43
 await ctx.serve({
43
 await ctx.serve({
44
     host: '0.0.0.0',
44
     host: '0.0.0.0',
45
-    port: 8000,
45
+    port: Number(process.env.PORT ?? 8000),
46
     servedir: 'www',
46
     servedir: 'www',
47
     keyfile: new URL('.local-server.key', import.meta.url).pathname,
47
     keyfile: new URL('.local-server.key', import.meta.url).pathname,
48
     certfile: new URL('.local-server.cert', import.meta.url).pathname,
48
     certfile: new URL('.local-server.cert', import.meta.url).pathname,

正在加载...
取消
保存