mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-14 03:54:46 +00:00
basic sapper dev task, with HMR
This commit is contained in:
@@ -5,6 +5,7 @@ import express from 'express';
|
||||
import cheerio from 'cheerio';
|
||||
import URL from 'url-parse';
|
||||
import fetch from 'node-fetch';
|
||||
import { wait_for_port } from './utils';
|
||||
|
||||
const { OUTPUT_DIR = 'dist' } = process.env;
|
||||
|
||||
@@ -55,8 +56,6 @@ export default async function exporter(dir: string) { // dir === '.sapper'
|
||||
}
|
||||
});
|
||||
|
||||
await require('wait-port')({ port });
|
||||
|
||||
function handle(url: URL) {
|
||||
if (url.origin !== origin) return;
|
||||
|
||||
@@ -85,6 +84,8 @@ export default async function exporter(dir: string) { // dir === '.sapper'
|
||||
});
|
||||
}
|
||||
|
||||
return handle(new URL(origin)) // TODO all static routes
|
||||
.then(() => proc.kill());
|
||||
wait_for_port(port, () => {
|
||||
handle(new URL(origin)) // TODO all static routes
|
||||
.then(() => proc.kill())
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user