diff --git a/src/api/export.ts b/src/api/export.ts index ed601e4..b539aac 100644 --- a/src/api/export.ts +++ b/src/api/export.ts @@ -60,7 +60,8 @@ async function _export({ sander.copyFileSync(build_dir, 'service-worker.js.map').to(export_dir, 'service-worker.js.map'); } - const port = await ports.find(3000); + const defaultPort = process.env.PORT ? parseInt(process.env.PORT) : 3000; + const port = await ports.find(defaultPort); const protocol = 'http:'; const host = `localhost:${port}`; @@ -199,4 +200,4 @@ async function _export({ function get_href(attrs: string) { const match = /href\s*=\s*(?:"(.*?)"|'(.+?)'|([^\s>]+))/.exec(attrs); return match[1] || match[2] || match[3]; -} \ No newline at end of file +}