I need to use functionality provided by the electron package (desktopCapturer), but as soon as I add const electron = require('electron') the generated bundle gives this error in Electron: Uncaught SyntaxError: Unexpected token else
Fuse-box: 1.3.118
My fuse.js:
const fsbx = require("fuse-box");
const fuseBox = fsbx.FuseBox.init({
homeDir: "src/",
outFile: "./build/out.js",
plugins: [],
serverBundle: true,
});
fuseBox.bundle(">index.js");
My index.js:
const electron = require('electron');
This is the bundle: https://gist.github.com/thepatrick/a75abb96ce98e45b513a7b8e88258fc0
Ideally I would actually not have electron bundled in at all, but I haven't found a way to say "hey, just use the require function provided by the environment please"
Hi!
I am no expert with electron, but there are people who might help
https://github.com/fuse-box/fuse-box/issues/212
Here's how you can use to get electron up & running.
Like many of the examples here, I used a vendor bundle and put this in:
{
shim: {
electron: { exports: "global.require('electron')" }
},
serverBundle: true
}
In your renderer code, you can import { clipboard } from 'electron' like you're used to. No need to target inclusion with +electron or anything like that.
These settings essentially just tell fuse-box to "hold my beer, i got this".
a Docs PR would be great :)
Closing this for now. Please feel free to check the latest bleeding edge version [email protected]
and documentation for it http://fuse-box.org:3333. You are welcome to re-open it elsewise ;-)
Please check the official electron seed https://github.com/fuse-box/fuse-box-electron-seed
Working great on 2.0.0-beta.8.
Most helpful comment
a Docs PR would be great :)