Merge pull request #566 from nolanlawson/nolan/issue-565

fix: fix "sapper export" with a custom PORT
This commit is contained in:
Rich Harris
2019-02-17 09:48:02 -04:00
committed by GitHub

View File

@@ -55,7 +55,8 @@ async function _export({
copy(path.join(build_dir, 'service-worker.js'), path.join(export_dir, 'service-worker.js')); copy(path.join(build_dir, 'service-worker.js'), path.join(export_dir, 'service-worker.js'));
copy(path.join(build_dir, 'service-worker.js.map'), path.join(export_dir, 'service-worker.js.map')); copy(path.join(build_dir, 'service-worker.js.map'), path.join(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 protocol = 'http:';
const host = `localhost:${port}`; const host = `localhost:${port}`;