Skip to content

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

@dolsem

Description

@dolsem

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions