fix(web): build browser extension as CommonJS so activate() is exported (#418 root cause) - #422
Conversation
…ed (#418) ROOT CAUSE of #418 (the web build never worked). out/extension-browser.js was built with format:'iife', which exports nothing on module.exports. The VS Code Web extension host loads the extension entry as CommonJS and calls module.exports.activate(context); with no activate export it found nothing, so the custom editor was never registered and databases spun forever on the loading screen in vscode.dev. Proven directly: the old iife bundle contained zero module.exports/activate; the real vscode.dev Extension Host log showed '_doActivateExtension zknpr.sqlite-explorer' then dead silence (no output channel, no webview); the cjs rebuild's export map is {GlobalOutputChannel, activate, activateProviders, deactivate} with a module.exports assignment. Fix: compileBrowserMain uses format:'cjs' (matching the desktop build). This is why the prior #418 work (1.3.6 parentPort adapter, 1.3.7 in-process engine, 1.3.8 instrumentation) could not fix the hang — activation itself never ran. Those changes remain correct groundwork; the in-process engine (1.3.7) is still required because Trusted Types blocks new Worker(blob) in the web ext-host. The 1.3.8 open-sequence instrumentation is intentionally retained for now; it will be removed once 1.3.9 is verified working in real vscode.dev. Verified: build OK (extension-browser.js exports activate; worker-free); tsc --noEmit clean; npm test 334/334. Bumps 1.3.8 -> 1.3.9. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughBuild configuration for the VS Code web extension browser bundle changed from IIFE to CommonJS format to enable module activation. Version incremented to 1.3.9 with changelog documenting the fix for the loading hang on web-based editors. ChangesVS Code Web Extension Loading Fix Release
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the browser extension build format from IIFE to CommonJS (cjs) in scripts/build.mjs to resolve an issue where the VS Code Web extension failed to activate, causing databases to hang on the loading screen. It also bumps the package version to 1.3.9 and documents the fix in the changelog. I have no feedback to provide as there are no review comments to assess.
Summary
This is the root cause of #418 — the vscode.dev web build never worked.
out/extension-browser.jswas built withformat: 'iife', which exports nothing onmodule.exports. The VS Code Web extension host loads the extension entry as a CommonJS module and callsmodule.exports.activate(context). With noactivateexport, it found nothing to call — so the extension'sactivate()never ran, the custom editor was never registered, and every database spun forever on the loading screen.Proof (direct, not inferred)
grep -c 'module.exports' out/extension-browser.js(iife) →0; noactivateexport anywhere._doActivateExtension zknpr.sqlite-explorer … onCustomEditor:sqlite-explorer.viewand then dead silence — no "SQLite Explorer" output channel created, no webview iframe, spinner forever. That's the exact signature ofactivate()never running.{GlobalOutputChannel, activate, activateProviders, deactivate}with amodule.exports = …assignment.Fix
scripts/build.mjs→compileBrowserMainusesformat: 'cjs'(matching the desktopcompileNodeMain). One line.Why the prior #418 work was necessary but not sufficient
Activation never ran, so nothing downstream could fix it. But the prior changes remain correct groundwork:
new Worker(blob)in the web ext-host (confirmed live), so the worker approach can't be restored.Verification
extension-browser.jsnow exportsactivate(verified in bundle); browser path still worker-free (in-process engine intact).tsc --noEmit -p tsconfig.jsonclean ·npm test334/334.@vscode/test-webcan't mount the workspace FS under automation). Plan: publish 1.3.9, open a DB in vscode.dev, confirm the grid.Refs #418.
Summary by CodeRabbit
Bug Fixes
Chores