webview-bun icon indicating copy to clipboard operation
webview-bun copied to clipboard

Webview does not open when script is run via package.json

Open dolsem opened this issue 9 months ago • 2 comments

I have a minimal Bun script like this:

import { Webview } from 'webview-bun';
import htmlFile from './build/index.html' with { type: 'file' };

const html = await Bun.file(htmlFile).text();
const webview = new Webview();
webview.setHTML(html);
webview.run();

It works fine if I run it like bun run webview.ts (except I get a benign error when the script finishes running, [1225/224708.165:ERROR:window_impl.cc(121)] Failed to unregister class Chrome_WidgetWin_0. Error = 1411).

If instead I add a package.json script: "webview": "bun run webview.ts" and run bun webview, the script gets stuck when trying to spawn the webview, with no error message. If I Ctrl-C to stop it, I see the same benign error as before.

My OS is Windows 11.

dolsem avatar Dec 26 '24 03:12 dolsem