Webview is a tiny cross-platform library to make web-based GUIs for desktop applications.
Platforms supported:
linux
,macos-x64
,macos-arm64
-
Install webkit2gtk dependency for linux.
Ubuntu:
sudo apt-get install libwebkit2gtk-4.0-dev
Arch Linux:
yay -S webkit2gtk
-
Install
webview-bun
and the latest compiled webview library from the releases of this repository.bun i webview-bun && bun node_modules/webview-bun/fetchLib.ts
import { Webview } from "webview-bun";
const html = `
<html>
<body>
<h1>Hello from bun v${Bun.version} !</h1>
</body>
</html>
`;
const webview = new Webview();
webview.setHTML(html);
webview.run();
For more examples, browse the examples
folder of this repository.
Refer to the comments in the source code for full documentation.
-
Clone the repository along with the webview submodule.
git clone --recurse-submodules --remote-submodules https://github.com/tr1ckydev/webview-bun.git
-
Install bun-types and build the library for your platform
bun i && bun run build
or, fetch the latest compiled library from the releases of this repository.
bun i && bun run postinstall
To use your own built webview library, set the
WEBVIEW_PATH
environment variable with the path to your webview shared library file.
Run the following example to see it in action.
bun run examples/basic.ts
This repository is a direct port of webview_deno by @eliassjogreen with various changes to work with the bun runtime.
This repository uses MIT license. See LICENSE for full license text.