SnosMe / uiohook-napi

MIT License
162 stars 37 forks source link

Support macOS arm64 #8

Closed lmk123 closed 2 years ago

lmk123 commented 2 years ago

When used on a Macbook M1, the following error is reported:

Error: No native build was found for platform=darwin arch=arm64 runtime=electron abi=103 uv=1 armv=8 libc=glibc node=16.13.2 electron=18.2.0 webpack=true

I hope you can provide the prebuild for macOS arm64, thanks.

lmk123 commented 2 years ago

I have confirmed that uihook-napi@1.1.0 works fine with macOS arm64.

Thank you for your work.

melMass commented 2 years ago

@lmk123 Have you done anything special?

I'm still getting Error: No native build was found for platform=darwin arch=arm64 runtime=electron abi=103 uv=1 armv=8 libc=glibc node=16.13.2 electron=18.2.3 webpack=true

lmk123 commented 2 years ago

@melMass try add this in your webpack config:

externals: {
  'uiohook-napi': 'commonjs uiohook-napi'
},
melMass commented 2 years ago

Yes!! Thanks a lot @lmk123

wasular commented 2 years ago

I still have this problem even though adding it to externals : const configuration: webpack.Configuration = { externals: [ ...Object.keys( externals || { 'uiohook-napi': 'commonjs uiohook-napi', } ), ],

...

sh4hids commented 2 years ago

If anyone using vite and having difficulties making uiohook-nap work, you can add it to rollupOptions in your vite.config.js like below:

...
...
    rollupOptions: {
      external: [
        'electron',
        'electron-devtools-installer',
        'uiohook-napi',
        ...builtinModules.flatMap((p) => [p, `node:${p}`]),
      ],
      output: {
        entryFileNames: '[name].cjs',
      },
    },
...
...