Skip to content

Commit 2308e4a

Browse files
Nikola HristovNikola Hristov
authored andcommitted
build: Conditionally load VSCode workbench script and externalize analytics packages
- Implemented environment-based conditional loading for VSCode workbench script: - Development/debug modes use cache-busted URL via Bust() utility - Production builds import directly from module path to leverage optimized bundling - Added Rollup configuration to externalize @microsoft/1ds-core-js and @microsoft/1ds-post-js - Prevents bundling of Microsoft's analytics SDKs, reducing final bundle size - Assumes these will be provided externally or loaded through alternative means These changes optimize production build output while maintaining developer experience with cache-refreshed resources during local development.
1 parent 3d15b19 commit 2308e4a

25 files changed

Lines changed: 51 additions & 26 deletions

File tree

Source/pages/Application.astro

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ const Default = {
146146
147147
const Bust = (Base: string): string =>
148148
`${Base}${Base.includes("?") ? "&" : "?"}v=${encodeURIComponent(Date.now())}`;
149+
150+
const On =
151+
process.env["NODE_ENV"] === "development" ||
152+
process.env["TAURI_ENV_DEBUG"] === "true";
149153
---
150154

151155
<Layout>
@@ -187,9 +191,21 @@ const Bust = (Base: string): string =>
187191
slot="Head"
188192
defer></script>
189193

190-
<script
191-
is:inline
192-
type="module"
193-
src={Bust("/Static/Application/vs/code/browser/workbench/workbench.js")}
194-
defer></script>
194+
{
195+
On ? (
196+
<script
197+
is:inline
198+
type="module"
199+
src={Bust(
200+
"/Static/Application/vs/code/browser/workbench/workbench.js",
201+
)}
202+
defer
203+
/>
204+
) : (
205+
<script>
206+
import
207+
"@codeeditorland/output/Target/Microsoft/VSCode/vs/code/browser/workbench/workbench.js";
208+
</script>
209+
)
210+
}
195211
</Layout>

Target/Application/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html class=no-js data-beasties-container dir=ltr lang=en><head><script type=module>document.documentElement.classList.remove("no-js"),document.documentElement.classList.add("js")</script><title></title><meta charset=utf-8><meta content name=description><meta content="width=device-width,initial-scale=1" name=viewport><meta content=#ffffff name=theme-color><meta content="telephone=no" name=format-detection><meta content=on name=twitter:dnt><meta data-settings={&#34;remoteAuthority&#34;:&#34;&#34;,&#34;serverBasePath&#34;:&#34;/&#34;,&#34;connectionToken&#34;:&#34;&#34;,&#34;enableWorkspaceTrust&#34;:true,&#34;settingsSyncOptions&#34;:{&#34;enabled&#34;:false},&#34;productConfiguration&#34;:{&#34;embedderIdentifier&#34;:&#34;desktop&#34;,&#34;nameShort&#34;:&#34;FIDDEE&#34;,&#34;nameLong&#34;:&#34;FIDDEE&#34;,&#34;applicationName&#34;:&#34;fiddee&#34;},&#34;developmentOptions&#34;:{&#34;logLevel&#34;:2,&#34;enableSmokeTestDriver&#34;:false}} id=vscode-workbench-web-configuration><link crossorigin=use-credentials href=/Manifest.json rel=manifest><script type=module>const Site="https://tauri.localhost/";globalThis._VSCODE_FILE_ROOT=`${Site}/Static/Application/`</script><script type=module src="/Worker/CSS/Load.js?v=1746275406527" defer=defer></script><script type=module>const Worker="/Worker.js?BASE_REMOTE=https%3A%2F%2Ftauri.localhost%2F&v=1746275406527";window._WORKER=Worker</script><script type=module src="/Worker/Policy.js?v=1746275406527"></script><script type=module src="/Worker/Register.js?v=1746275406527" defer=defer></script></head><body aria-label><script type=module src="/Static/Application/vs/code/browser/workbench/workbench.js?v=1746275406528" defer=defer></script></body></html>
1+
<!DOCTYPE html><html class=no-js data-beasties-container dir=ltr lang=en><head><script type=module>document.documentElement.classList.remove("no-js"),document.documentElement.classList.add("js")</script><title></title><meta charset=utf-8><meta content name=description><meta content="width=device-width,initial-scale=1" name=viewport><meta content=#ffffff name=theme-color><meta content="telephone=no" name=format-detection><meta content=on name=twitter:dnt><meta data-settings={&#34;remoteAuthority&#34;:&#34;&#34;,&#34;serverBasePath&#34;:&#34;/&#34;,&#34;connectionToken&#34;:&#34;&#34;,&#34;enableWorkspaceTrust&#34;:true,&#34;settingsSyncOptions&#34;:{&#34;enabled&#34;:false},&#34;productConfiguration&#34;:{&#34;embedderIdentifier&#34;:&#34;desktop&#34;,&#34;nameShort&#34;:&#34;FIDDEE&#34;,&#34;nameLong&#34;:&#34;FIDDEE&#34;,&#34;applicationName&#34;:&#34;fiddee&#34;},&#34;developmentOptions&#34;:{&#34;logLevel&#34;:2,&#34;enableSmokeTestDriver&#34;:false}} id=vscode-workbench-web-configuration><link href=/Manifest.json rel=manifest crossorigin=use-credentials><script type=module>const Site="https://tauri.localhost/";globalThis._VSCODE_FILE_ROOT=`${Site}/Static/Application/`</script><script type=module src="/Worker/CSS/Load.js?v=1746323690121" defer=defer></script><script type=module>const Worker="/Worker.js?BASE_REMOTE=https%3A%2F%2Ftauri.localhost%2F&v=1746323690121";window._WORKER=Worker</script><script type=module src="/Worker/Policy.js?v=1746323690121"></script><script type=module src="/Worker/Register.js?v=1746323690121" defer=defer></script><style>:root{--vscode-sash-size:4px;--vscode-sash-hover-size:4px}@property --chat-editing-last-edit-shift{syntax:"<percentage>";initial-value:100%;inherits:false}@property --inline-chat-frame-progress{syntax:"<percentage>";initial-value:0%;inherits:false}body{height:100%;width:100%;margin:0;padding:0;overflow:hidden;font-size:11px;user-select:none;-webkit-user-select:none}</style><link href=/_astro/Application.CRM72xFj.css rel=stylesheet media=print onload="this.media=&#34;all&#34;"><noscript><link href=/_astro/Application.CRM72xFj.css rel=stylesheet></noscript></head><body aria-label><script type=module src=/_astro/Application.astro_astro_type_script_index_0_lang.DUbb6N5r.js></script></body></html>

Target/Static/Application/vs/base/common/comparers.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)