-
-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forge make combined with vite is creating an incomplete asar #3738
Comments
I'm not sure about 7.5.0 but in earlier versions it was needed to move |
This works as expected downgrading to 7.4.0. I'll give this a try but no bundles are getting added to the app.asar file at 7.5.0. Well now I'm getting a require is not defined error after making the project. :/ |
@steveoh I use electron-log and it works fine after downgrading. |
I've had this happen to ubuntu as well, but found a way to get the trick: |
Ran into a similar issue with other packages. Found a work-around and modified it to work for me. Seems // forge.config.js
const { spawn } = require('node:child_process');
module.exports = {
hooks: {
packageAfterPrune: async (config, build_path) => {
const vite_config = await import('./vite.preload.config.mjs');
const external = vite_config?.default?.build?.rollupOptions?.external || [];
const commands = [
'install',
'--no-package-lock',
'--no-save',
...external,
];
return new Promise((resolve, reject) => {
npm = spawn('npm', commands, {
cwd: build_path,
stdio: 'inherit',
shell: true,
});
npm.on('close', (code) => {
if (0 === code) {
resolve();
return;
}
reject(`Process exited with code: ${code}`);
});
npm.on('error', reject);
});
},
},
// ...
}; |
same issue here, happens when trying to load a json file
|
temp workaround is to disable asar by modifying the following properties in const config: ForgeConfig = {
packagerConfig: {
asar: false,
},
plugins: [
new FusesPlugin({
[FuseV1Options.OnlyLoadAppFromAsar]: false,
}),
],
}; |
Pre-flight checklist
Electron Forge version
7.5.0
Electron version
33.0.1
Operating system
windows 11
Last known working Electron Forge version
7.4.0
Expected behavior
npm run make creates an asar file that includes the node_modules and the app can run on windows successfully.
Actual behavior
node_modules aren't present and install fails with ERR_MODULE_NOT_FOUND
Steps to reproduce
Additional information
This is only happening on windows as I believe that is the only place that asar is used.
We are using vite instead of webpack.
The main.js file from within the asar in the error message imports the following
Where electron-window-state and update-electron-app and I assume electron-squirrel-startup are not available to be imported.
The text was updated successfully, but these errors were encountered: