Skip to content

[REGRESSION] webpack-plugin generates different output for arm64 and x64 builds on Mac OS, breaking universal builds #3436

@TheRealCuran

Description

@TheRealCuran

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.2.0

Electron version

27.1.3

Operating system

macOS 14.1.1

Last known working Electron Forge version

7.1.0

Expected behavior

Uiversal builds can be generated with electron-forge make --arch=universal --target=dmg --platform=darwin and it is ensured, that the same JS output is used for both the arm64 and the x64 build.

Since the same Electron version is used in both cases, there shouldn't be a need for a different JS build anyway.

Actual behavior

@electron-forge/plugin-webpack is invoked twice (once for each arch) and generates slightly different arranged JS output – contents are the same for me, but the position of chunks has changed – leading to the following error during any universal build:

[FAILED] Expected all non-binary files to have identical SHAs when creating a universal build but "Contents/Resources/app/.webpack/main/index.js" did not
[FAILED] Expected all non-binary files to have identical SHAs when creating a universal build but "Contents/Resources/app/.webpack/main/index.js" did not
[FAILED] Expected all non-binary files to have identical SHAs when creating a universal build but "Contents/Resources/app/.webpack/main/index.js" did not
An unhandled rejection has occurred inside Forge:
Error: Expected all non-binary files to have identical SHAs when creating a universal build but "Contents/Resources/app/.webpack/main/index.js" did not
at Object.makeUniversalApp (/Users/gitlab/builds/[REDACTED]/node_modules/@electron/universal/dist/cjs/index.js:113:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async packageUniversalMac (/Users/gitlab/builds/[REDACTED]/node_modules/@electron/packager/src/universal.js:56:3)
    at async Promise.all (index 0)
    at async packager (/Users/gitlab/builds/[REDACTED]/node_modules/@electron/packager/src/index.js:204:20)

I would assume, that this is a regression introduced by #3433

Steps to reproduce

Can't really hand out our application here, but since the solution seems easy enough: just build the JS only once or at least use the same JS for both parts of the universal binary, I don't think a reproducer is really needed. Very trivial applications do not show this issue (ie. just the template app (npm init electron-app@latest my-app -- --template=webpack) is not affected).

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions