Skip to content
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

Optional dependencies excluded with plugin-vite #3599

Open
3 tasks done
jclem opened this issue May 16, 2024 · 1 comment
Open
3 tasks done

Optional dependencies excluded with plugin-vite #3599

jclem opened this issue May 16, 2024 · 1 comment

Comments

@jclem
Copy link

jclem commented May 16, 2024

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

7.4.0

Electron version

29.2.0

Operating system

macOS 14.5

Last known working Electron Forge version

No response

Expected behavior

When building an app with optional dependencies and the Vite plugin, optional dependencies are included in the build output.

Actual behavior

Optional dependencies are excluded from the output.

Steps to reproduce

Build a project using https://github.com/lovell/sharp, which has optional dependencies. They will not be in the packaged node_modules, and so their native binaries can not be copied.

Additional information

Adding them as dependencies is a poor solution, since they are platform-specific.

@jclem
Copy link
Author

jclem commented May 16, 2024

I have had to fix this by using this hook in my Forge config:

async packageAfterCopy(_config, buildPath) {
  await NodeFSExtra.copy(
    "node_modules/@img",
    NodePath.join(buildPath, "node_modules/@img"),
  );
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant