-
-
Notifications
You must be signed in to change notification settings - Fork 520
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
package command fails when using yarn workspaces with native dependency #3734
Comments
I managed to trace the issue and I believe it is indeed related to the vite plugin. If I add the following to my
It works now as expected. I can even delete the entire |
Ok I've got the vite plugin working now too. I had to do 2 things:
Here is my working import type { ForgeConfig } from "@electron-forge/shared-types";
import { MakerSquirrel } from "@electron-forge/maker-squirrel";
import { MakerZIP } from "@electron-forge/maker-zip";
import { MakerDeb } from "@electron-forge/maker-deb";
import { MakerRpm } from "@electron-forge/maker-rpm";
import { VitePlugin } from "@electron-forge/plugin-vite";
import { FusesPlugin } from "@electron-forge/plugin-fuses";
import { FuseV1Options, FuseVersion } from "@electron/fuses";
const config: ForgeConfig = {
packagerConfig: {
asar: false,
extraResource: ["./node_modules/asr"],
derefSymlinks: true,
ignore: (file) => {
if (!file) {
return false;
}
if (file.startsWith("/.vite")) {
return false;
}
if (
file === "/node_modules" ||
file.startsWith("/node_modules/asr") ||
file.startsWith("/node_modules/electron-squirrel-startup")
) {
return false;
}
return true;
},
},
makers: [
new MakerSquirrel({}),
new MakerZIP({}, ["darwin"]),
new MakerRpm({}),
new MakerDeb({}),
],
plugins: [
new VitePlugin({
build: [
{
entry: "src/main.ts",
config: "vite.main.config.ts",
target: "main",
},
{
entry: "src/preload.ts",
config: "vite.preload.config.ts",
target: "preload",
},
],
renderer: [
{
name: "main_window",
config: "vite.renderer.config.ts",
},
],
}),
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
}),
],
};
export default config; Alternatively I can set |
Hey @mtharrison, thanks so much for your work on this! If it's no trouble, we'd definitely accept a PR to make this experience better or outline it more clearly in the docs. If you don't have time to do that, we can take a look at doing this 🙇♀ |
Sure, happy to. I'll take a look soon 😄 |
Pre-flight checklist
Electron Forge version
7.5.0
Electron version
v32.1.2
Operating system
MacOS 14.7
Last known working Electron Forge version
No response
Expected behavior
Electron-forge should dereference symlinks (or provide an option to) when copying the package.
Actual behavior
It does not dereference the symlinked dependencies leading to error:
Steps to reproduce
I'm using yarn (
4.5.0
) workspaces and I have packagesasr
is a dependency ofapplication
.When I run
yarn package
it fails with the following error:I see the dir it is stat'ing is a symlink:
A workaround is running:
If I run this and then rerun
yarn package
. The application will build correctly.Is there any way to make electron-force understand it should dereference this symlink when copying the package?
I see a similar issue at #3624 with a suggested fix to the vite plugin. Would you be happy to take a PR for this?
Additional information
No response
The text was updated successfully, but these errors were encountered: