chore(trace viewer): support HMR
This commit is contained in:
parent
445ff73c6e
commit
67e77d0139
|
|
@ -127,7 +127,11 @@ export async function installRootRedirect(server: HttpServer, traceUrls: string[
|
|||
|
||||
params.set('server', server.urlPrefix('precise'));
|
||||
|
||||
const urlPath = `./trace/${options.webApp || 'index.html'}?${params.toString()}`;
|
||||
let baseUrl = '.';
|
||||
if (process.env.PW_HMR)
|
||||
baseUrl = 'http://localhost:44223'; // port is hardcoded in build.js
|
||||
|
||||
const urlPath = `${baseUrl}/trace/${options.webApp || 'index.html'}?${params.toString()}`;
|
||||
server.routePath('/', (_, response) => {
|
||||
response.statusCode = 302;
|
||||
response.setHeader('Location', urlPath);
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ const xtermDataSource: XtermDataSource = {
|
|||
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
const guid = searchParams.get('ws');
|
||||
const wsURL = new URL(`../${guid}`, window.location.toString());
|
||||
wsURL.protocol = (window.location.protocol === 'https:' ? 'wss:' : 'ws:');
|
||||
const wsURL = new URL(`/${guid}`, searchParams.get('server') ?? window.location.toString());
|
||||
wsURL.protocol = (wsURL.protocol === 'https:' ? 'wss:' : 'ws:');
|
||||
const queryParams = {
|
||||
args: searchParams.getAll('arg'),
|
||||
grep: searchParams.get('grep') || undefined,
|
||||
|
|
|
|||
Loading…
Reference in a new issue