Windows on ARM
If your app runs with Electron 6.0.8 or later, you can now build it for Windows 10 on Arm. This considerably improves performance, but requires recompilation of any native modules used in your app. It may also require small fixups to your build and packaging scripts.
Запуск базового приложения
Если ваше приложение не использует нативные модули, то создать Arm версию приложения очень просто.
- Убедитесь, что каталог
node_modules
вашего приложения пуст. - Using a Command Prompt, run
set npm_config_arch=arm64
before runningnpm install
/yarn install
as usual. - If you have Electron installed as a development dependency, npm will download and unpack the arm64 version. You can then package and distribute your app as normal.
General considerations
Architecture-specific code
Lots of Windows-specific code contains if... else logic that selects between either the x64 or x86 architectures.
if (process.arch === 'x64') {
// Do 64-bit thing...
} else {
// Do 32-bit thing...
}
If you want to target arm64, logic like this will typically select the wrong architecture, so carefully check your application and build scripts for conditions like this. In custom build and packaging scripts, you should always check the value of npm_config_arch
in the environment, rather than relying on the current process arch.
Native modules
If you use native modules, you must make sure that they compile against v142 of the MSVC compiler (provided in Visual Studio 2017). You must also check that any pre-built .dll
or .lib
files provided or referenced by the native module are available for Windows on Arm.
Testing your app
To test your app, use a Windows on Arm device running Windows 10 (version 1903 or later). Make sure that you copy your application over to the target device - Chromium's sandbox will not work correctly when loading your application assets from a network location.
Development prerequisites
Node.js/node-gyp
Node.js v12.9.0 or later is recommended. If updating to a new version of Node is undesirable, you can instead update npm's copy of node-gyp manually to version 5.0.2 or later, which contains the required changes to compile native modules for Arm.