fix(lana): bundle the web extension as a single file - #1001
Merged
Conversation
The web extension host loads the entry point with fetch and
new Function('module', 'exports', 'require', source). The require it supplies
resolves only 'vscode', so the bundle must be one file.
Both web builds split lana-salesforceServices out of the entry, because
RetrieveLogFile imports it dynamically. The require for that chunk sits in the
lazy path, so the extension activated but Retrieve Apex Log failed in the web
host.
Each build now emits only Main.web.cjs. This makes chunkFileNames dead, so it
goes.
lcottercertinia
approved these changes
Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR overview
Follow-up to #953 and #957.
Log: Retrieve Apex Log And Show Analysiscannot work in the webextension host, because the web bundle is split across two files.
The problem
The web extension host does not use Node's loader. It fetches the entry point as text and wraps
it:
The
requireit supplies resolves only'vscode'.importScriptsis blocked, andrequireand
defineare set toundefinedin the worker. The docs say it plainly: "Importing orrequiring other modules is not supported... the code must be packaged to a single file."
Both web builds emitted two files:
RetrieveLogFile.ts:56doesawait import('../services/salesforceServices.js'), which rolluplowers to
require("./lana-salesforceServices.js"). That require throws in the web host.It sits in the lazy path near the end of the file, not at the top, so the extension still
activates and only Retrieve is affected.
Changes made
rollup.config.mjs:inlineDynamicImports: trueon the web output.rolldown.config.ts:codeSplitting: falseon the web output. Rolldown deprecatesinlineDynamicImportsin favour of this name, hence the difference.chunkFileNamesfrom both, now that neither emits a chunk.Type of change
Validation
Built both paths, production mode:
lana/out/web/Main.web.cjs, 806,071 byteslana/out/web/Main.web.cjsrequire("vscode")+require("./lana-salesforceServices.js")require("vscode")onlyThe desktop entry is unchanged and still ESM.
Not validated: I have not run this in a live web host, so the fix is verified against the
emitted bundle and the documented loader, not observed. The web e2e in CI exercises
Log: Show Apex Log Analysis, not Retrieve, so it will not catch this either way.Related
Considered and rejected in the same area: dropping
nodePolyfills()from the web target. Thebuild succeeds without it, but 11
process.references survive, and while most are guarded bytypeof process,path.resolve()'s shim calls a bareprocess.cwd(). Removing the pluginwould turn a working shim into a latent
ReferenceError, so it stays.