import '../../common/init';
import { isMainThread, workerData } from 'worker_threads';
import { wrt } from '../../browser/wrt';
+import { URL } from 'url';
import * as fs from 'fs';
import * as https from 'https';
import * as XWalkExtension from '../../common/wrt_xwalk_extension';
function concatWithBaseUrl(path: string, baseUrl: string) {
if (path.substr(0, 1) === '/') {
- return baseUrl.substr(0, baseUrl.indexOf('/') + 1) + path;
+ const url = new URL(path, baseUrl);
+ return url.toString();
} else if (path.indexOf('http:') == -1 && path.indexOf('https:') == -1) {
return baseUrl.substr(0, baseUrl.lastIndexOf('/') + 1) + path;
}