Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can wasm-component-model-async run in a web extension? #1138

Closed
lamb opened this issue Jan 10, 2025 · 2 comments
Closed

can wasm-component-model-async run in a web extension? #1138

lamb opened this issue Jan 10, 2025 · 2 comments
Assignees

Comments

@lamb
Copy link

lamb commented Jan 10, 2025

Extension sample

wasm-component-model-async

VS Code version

1.96

What went wrong?

node ./bin/esbuild.js

Debugger attached.
✘ [ERROR] Could not resolve "worker_threads"

src/extension.ts:3:23:
  3 │ import { Worker } from 'worker_threads';
    ╵                        ~~~~~~~~~~~~~~~~

The package "worker_threads" wasn't found on the file system but is built into node. Are you
trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this
error.

Error: Build failed with 1 error:
src/extension.ts:3:23: ERROR: Could not resolve "worker_threads"
at failureErrorWithLog (/Users/.../node_modules/esbuild/lib/main.js:1476:15)
at /Users/.../node_modules/esbuild/lib/main.js:945:25
at /Users/.../node_modules/esbuild/lib/main.js:897:52
at buildResponseToResult (/Users/.../node_modules/esbuild/lib/main.js:943:7)
at /Users/.../node_modules/esbuild/lib/main.js:955:9
at new Promise ()
at requestCallbacks.on-end (/Users/.../node_modules/esbuild/lib/main.js:954:54)
at handleRequest (/Users/.../node_modules/esbuild/lib/main.js:647:17)
at handleIncomingPacket (/Users/.../node_modules/esbuild/lib/main.js:672:7)
at Socket.readFromStdout (/Users/.../node_modules/esbuild/lib/main.js:600:7) {
errors: [Getter/Setter],
warnings: [Getter/Setter]

@lamb lamb changed the title can wasm-component-model-async run in a web extension wasm-component-model-async can not run in a web extension Jan 10, 2025
@lamb lamb changed the title wasm-component-model-async can not run in a web extension can wasm-component-model-async run in a web extension? Jan 10, 2025
@alexr00 alexr00 assigned dbaeumer and unassigned alexr00 Jan 13, 2025
@dbaeumer
Copy link
Member

Actually it should work. But you need to include the types from browser instead of node. E.G. from here https://github.com/microsoft/vscode-wasi/blob/main/wasm-component-model/src/browser/main.ts#L5 and see https://github.com/microsoft/vscode-wasi/blob/main/wasm-component-model/package.json#L33

@lamb
Copy link
Author

lamb commented Jan 19, 2025

@dbaeumer can you update wasm-component-model-async sample support web extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants