Fixes monaco webworker and chunk loading issues.
This commit is contained in:
@@ -59,8 +59,12 @@ export class Server {
|
||||
return `http://localhost:${port}/index.html?serverPort=${this.port}&serverSecret=${this.secret}${inWebView}${expr}`;
|
||||
}
|
||||
|
||||
public get publicPath(): string {
|
||||
return `http://localhost:${this.port}/`;
|
||||
}
|
||||
|
||||
public get mainBundleUrl(): string {
|
||||
return `http://localhost:${this.port}/main.js`;
|
||||
return `${this.publicPath}main.js`;
|
||||
}
|
||||
|
||||
public get port(): number {
|
||||
|
||||
@@ -62,7 +62,7 @@ export function getHtml(server: Server) {
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * 'unsafe-inline';">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * 'unsafe-inline'; worker-src * data: 'unsafe-inline' 'unsafe-eval'; font-src * 'unsafe-inline' 'unsafe-eval';">
|
||||
<style>
|
||||
html { height: 100%; width: 100%; padding: 0; margin: 0; }
|
||||
body { height: 100%; width: 100%; padding: 0; margin: 0; }
|
||||
@@ -74,6 +74,7 @@ export function getHtml(server: Server) {
|
||||
window.webViewData = ${JSON.stringify({
|
||||
serverSecret: server.secret,
|
||||
serverPort: server.port,
|
||||
publicPath: server.publicPath,
|
||||
})};
|
||||
const api = window.VsCodeApi = acquireVsCodeApi();
|
||||
window.addEventListener('message', event => {
|
||||
@@ -89,6 +90,7 @@ export function getHtml(server: Server) {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
${
|
||||
isDev
|
||||
? `<iframe sandbox="allow-top-navigation allow-scripts allow-same-origin allow-popups allow-pointer-lock allow-forms" src="${server.getIndexUrl(
|
||||
|
||||
@@ -17,9 +17,15 @@ import { Disposable } from "@hediet/std/disposable";
|
||||
import { startInterval } from "@hediet/std/timer";
|
||||
|
||||
declare const window: Window & {
|
||||
webViewData?: { serverSecret: string; serverPort: number };
|
||||
webViewData?: {
|
||||
serverSecret: string;
|
||||
serverPort: number;
|
||||
publicPath: string;
|
||||
};
|
||||
};
|
||||
|
||||
declare let __webpack_public_path__: string;
|
||||
|
||||
export class Model {
|
||||
public readonly dispose = Disposable.fn();
|
||||
public readonly runningMode: "standalone" | "webView" | "webViewIFrame" =
|
||||
@@ -83,6 +89,7 @@ export class Model {
|
||||
this.port = data.serverPort;
|
||||
this.serverSecret = data.serverSecret;
|
||||
this.runningMode = "webView";
|
||||
__webpack_public_path__ = data.publicPath;
|
||||
|
||||
const updateTheme = () => {
|
||||
const isLight = document.body.classList.contains(
|
||||
|
||||
Reference in New Issue
Block a user