File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,14 +5,14 @@ import NLS from "./NLS.astro";
55<Fragment >
66 <NLS />
77
8- <!-- Browser Workbench Script -->
9- <!-- Dynamic import matches the pattern used by Mountain.astro, BrowserTest.astro,
10- BrowserProxy/Workbench.ts, and Electron/Workbench.ts. Static imports cause
11- Rollup to hard-fail at build time (cannot resolve package specifiers).
12- Dynamic imports only warn on resolution failure and allow the build to complete. -->
13- < script >
14- await import(
15- "@codeeditorland/output/vs/code/ browser/ workbench/workbench.js"
16- );
8+ <!-- VS Code Browser Workbench — loaded via inline script to bypass Vite bundling.
9+ /vs/ is served from Sky/Public/vs → Output/Target/Microsoft/VSCode/vs (symlink).
10+ Relative imports inside workbench.js (../../../base/...) resolve against /vs/. -->
11+ < script is:inline type = " module " >
12+ try {
13+ await import("/vs/code/browser/workbench/workbench.js");
14+ } catch (error) {
15+ console.error("[Browser] Failed to load VS Code browser workbench:", error);
16+ }
1717 </script >
1818</Fragment >
Original file line number Diff line number Diff line change @@ -12,8 +12,10 @@ interface MountainProxyWindow extends Window {
1212console . log ( "[BrowserProxy] ===== Loading browser VSCode workbench =====" ) ;
1313
1414try {
15- // Import the browser workbench
16- await import ( "@codeeditorland/output/vs/code/browser/workbench/workbench.js" ) ;
15+ // Variable URL: Rollup only analyzes string literals — an identifier
16+ // reference is treated as truly dynamic and never resolved at build time.
17+ const WorkbenchUrl = "/vs/code/browser/workbench/workbench.js" ;
18+ await import ( WorkbenchUrl ) ;
1719
1820 console . log (
1921 "[BrowserProxy] ✓ Browser workbench script loaded successfully" ,
Original file line number Diff line number Diff line change @@ -73,17 +73,15 @@ import NLS from "./NLS.astro";
7373 );
7474 </script >
7575
76- <!-- Browser Workbench Script -->
77- <script type =" module" >
78- await import("@codeeditorland/output/vs/code/browser/workbench/workbench.js");
79-
80- console.log(
81- "[BrowserTest] ===== Loading browser VSCode workbench =====",
82- );
83- console.log(
84- "[BrowserTest] ✓ Browser workbench script loaded successfully",
85- );
86-
76+ <!-- Browser Workbench Script — is:inline bypasses Vite bundling entirely -->
77+ <script is:inline type =" module" >
78+ try {
79+ await import("/vs/code/browser/workbench/workbench.js");
80+ console.log("[BrowserTest] ===== Loading browser VSCode workbench =====");
81+ console.log("[BrowserTest] ✓ Browser workbench script loaded successfully");
82+ } catch (error) {
83+ console.error("[BrowserTest] Failed to load VS Code browser workbench:", error);
84+ }
8785 console.log("[BrowserTest] ===== Workbench load attempted =====");
8886 </script >
8987</Fragment >
Original file line number Diff line number Diff line change 2222 // Import the Electron workbench (NOT browser workbench)
2323 // Electron workbench uses Electron-specific APIs
2424 // @ts -ignore - Dynamic import for side effects, .d.ts file is not a module but the .js file exists at runtime
25- await import ( "@codeeditorland/output/vs/code/electron-browser/workbench/workbench.js" ) ;
25+ // electron-browser workbench.js is not compiled in Output — only .d.ts exists.
26+ // When the Electron approach is activated, this path will need to be compiled first.
27+ // await import("/vs/code/electron-browser/workbench/workbench.js");
2628
2729 console . log ( "[Electron] ✓ Electron workbench script loaded successfully" ) ;
2830 console . log ( "[Electron] ===== Workbench load complete =====" ) ;
Original file line number Diff line number Diff line change @@ -192,9 +192,10 @@ import NLS from "./NLS.astro";
192192 );
193193
194194 try {
195- // Import the browser workbench (NOT Electron workbench)
196- // Browser workbench works without the vscode-file:// CSP errors
197- await import("@codeeditorland/output/vs/code/browser/workbench/workbench.js");
195+ // Variable URL: Rollup only analyzes string literals — an identifier
196+ // reference is treated as truly dynamic and never resolved at build time.
197+ const WorkbenchUrl = "/vs/code/browser/workbench/workbench.js";
198+ await import(WorkbenchUrl);
198199
199200 console.log(
200201 "[Mountain] ✓ Browser workbench script loaded successfully",
Original file line number Diff line number Diff line change @@ -72,9 +72,10 @@ export default defineConfig({
7272 external : [
7373 ...External ,
7474 ( id : string ) =>
75- // Pre-resolved package specifier — catches @codeeditorland/output/vs/**
76- // before Rollup attempts resolution. Static imports of unresolved
77- // package specifiers are hard build errors; dynamic imports warn only.
75+ // Absolute browser URL paths (/vs/...) — Rollup treats / as filesystem,
76+ // but these are real browser URLs served at runtime. Mark external.
77+ id . startsWith ( "/vs/" ) ||
78+ // Package specifier — catches @codeeditorland/output/vs/**
7879 id . startsWith ( "@codeeditorland/output/vs/" ) ||
7980 // Resolved absolute path (after symlink + package.json exports map)
8081 id . includes (
You can’t perform that action at this time.
0 commit comments