tr1ckydev / webview-bun

Bun bindings for webview, a tiny library for creating web-based desktop GUIs.
https://www.npmjs.com/package/webview-bun
MIT License
201 stars 8 forks source link

Single File errors on windows #11

Closed andy-davies closed 1 month ago

andy-davies commented 1 month ago

While testing with bun run index.ts everything looks great with my most basic of apps, however when I run the command to buld a single file exe

bun build --compile --minify --sourcemap ./index.ts --outfile todoapp

the resulting exe (on Windows x64) fails to open and the following error is displayed:

Windows cannot access the specified device, path or file. You may not have the appropriate permissions to access the item

My index.ts looks like this:

`import { Webview } from "webview-bun";

const html = `
<html>
    <body>
        <h1>Hello from bun v${Bun.version} !</h1>
         <button onclick="addInNode().then((r)=>alert(r))">
        Test
    </button>
    </body>
</html>
`;

const webview = new Webview();

webview.setHTML(html);

console.log("Hello from Node.js !");

webview.bind("addInNode", ()=>{           // The first parameter is the Webview and the rest are user's.
    let r = parseInt("1") + parseInt("2");   // This will run in Node.js
    console.log(r);                            // This will run in Node.js
    return r;                                  // return the result to webview
});

webview.title="blah";

webview.run();`

Does anyone know what might be happening?

andy-davies commented 1 month ago

Problem was in my system security settings, not in this package.

andy-davies commented 1 month ago

closed