Written in the beginning
- Due to the latest
Electron
Already supportedM1
The chip,arm
Under the framework ofMac
- When developing desktop software, the inevitable need to package self-test, so in
M1
On the chipMac
Package the software that ADAPTS oneself also should - So now make the Electron desktop software, should be adapted
linux,windows,mac os
(x86
Architecture,arm
Architecture) four system environments
Why write this article
- Some of the software I use does not support ARM-based Macs, and the update speed is too slow. Obviously, it relies on Electron. In fact, most of the software upgrades are not expensive
background
Electron
It does not support XP, and will almost always be released as soon as Node.js is upgraded (use nw.js if you want xp compatibility, etc.).- At present
node.js
The latest version 15.x has been adapted for Mac based on arm architecture.electron11.0.0
The version also supports Mac running under ARM architecture. I need to test the compatibility of the software I developed on my own computer, so I need to upgrade the Electron version and various plug-ins this time
start
- First, upgrade Electron to version 11.0.0
Yarn add [email protected] - saveCopy the code
- upgrade
electron-builder
to22.9.1
Version of the above
Yarn add electron - builder @ ^ 22.9.1 - DCopy the code
- Modify the
package.json
thebuild
The value of Mac in the field:
"MAC" : {" target ": {" target" : "get", "arch" : [" arm64 ", "x64"]}}Copy the code
- Build, keep reporting errors. Anyway, all kinds of weird errors, later I found out that THERE was something wrong with my configuration, and finally found it here
https://github.com/electron-userland/electron-builder/issues/5392
Copy the code
- Modify the configuration to
"mac": {
"target" : { "target": "dir", "arch": "arm64" }
},
Copy the code
- At the same time, modify the command under the package construction arm architecture as follows:
electron-builder build --arm64
Copy the code
In the end
- Upgrade adaptation Succeeded
- It’s DMG, and you can actually open it
- A very short but very useful tutorial, if you happen to upgrade your application to be compatible with M1, then upgrade now!
- Order one if you think it’s good
Looking at the/praise
, click follow [The front-end peak
】.