Obtaining more information on why a published extension with a web target fails to load #2964
Replies: 2 comments 1 reply
-
|
Hi @miqh , I'm not an expert in bundling, but I have noticed you are using esbuild to it, and comparing your ...
async function main() {
const ctx = await esbuild.context({
entryPoints: ['src/web/extension.ts', 'src/web/test/suite/extensionTests.ts'],
bundle: true,
format: 'cjs',
minify: production,
sourcemap: !production,
sourcesContent: false,
platform: 'browser',
outdir: 'dist/web',
external: ['vscode'],
logLevel: 'warning',
// Node.js global to browser globalThis
define: {
global: 'globalThis'
},
plugins: [
polyfill.NodeGlobalsPolyfillPlugin({
process: true,
buffer: true
}),
testBundlePlugin,
esbuildProblemMatcherPlugin /* add to the end of plugins array */
]
});
...package.json "scripts": {
"vscode:prepublish": "npm run package-web",
"compile-web": "npm run check-types && node esbuild.js",
"watch-web": "npm-run-all -p watch-web:*",
"watch-web:esbuild": "node esbuild.js --watch",
"watch-web:tsc": "tsc --noEmit --watch --project tsconfig.json",
"package-web": "npm run check-types && node esbuild.js --production",
"check-types": "tsc --noEmit",
"pretest": "npm run compile-web",
"test": "vscode-test-web --browserType=chromium --extensionDevelopmentPath=. --extensionTestsPath=dist/web/test/suite/extensionTests.js",
"run-in-browser": "vscode-test-web --browserType=chromium --extensionDevelopmentPath=. ."
}Hope this helps |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for the reply @alefragnani. Good catch with the
Update: Embarrassingly, it never dawned on me to try slipping in some breakpoints on the web version of VS Code to see what was going wrong. Shortly after probing around, I discovered that, for some odd reason, despite explicitly choosing the Although this does feel like a bug in VS Code to me, I speculate that it's probably an uncommon situation I find myself in, where I'm both trying to use a pre-release, and also adding web support that was never originally there in the extension. I expect that when I eventually publish a version that isn't a pre-release, that things should work, but time will tell as I continue to do some testing. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm unable to figure out why my theme-based extension can't be loaded in a web environment (e.g. vscode.dev). When trying to install it (it's a pre-release for now), I'm prompted with the following:
Clicking the "More Information" button takes me to a VS Code documentation page clarifying the conditions that need to be met for an extension to be available for a web environment.
I've reviewed these, but to no avail. Some things I've checked:
package.jsonincludes abrowserproperty, which points to an extension entry point bundle specifically for the web.vscode.ExtensionContext.globalStateandvscode.window.showInformationMessage, both of which I assume should be safe in a web context.!isWeb && coreTheme.devOnly. Note the latter is a custom when clause context that's only set when running the extension in development.Are there any other channels from which I can obtain more information on exactly why my web target of my extension refuses to load?
Any guidance would be much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions