ncc icon indicating copy to clipboard operation
ncc copied to clipboard

ncc vs Serialport Part 2 - missing binaries (assets)

Open jeffrson opened this issue 3 years ago • 2 comments

For serialport (https://www.npmjs.com/package/serialport) 10, ncc fails with ESM as well (https://github.com/vercel/ncc/issues/899).

Furthermore it fails to copy binary assets (*.node).

  1. yarn init -y
  2. yarn add serialport
  3. file index.cjs
const SerialPort = require('serialport')
  1. ncc build .\index.cjs -s -C --target es2020
> node .\dist\index.cjs

C:\temp\sp_test\dist\index.cjs:3496
  throw new Error('No native build was found for ' + target + '\n    loaded from: ' + dir + '\n')
        ^
Error: No native build was found for platform=win32 arch=x64 runtime=node abi=93 uv=1 libc=glibc node=16.14.2 webpack=true
    loaded from: C:\temp\sp_test

    at Function.load.path (C:\temp\sp_test\dist\index.cjs:3496:9)
    at load (C:\temp\sp_test\dist\index.cjs:3458:30)
    at Object.296 (C:\temp\sp_test\dist\index.cjs:804:46)
...

ncc 0.33.3

jeffrson avatar Mar 29 '22 08:03 jeffrson

@guybedford Any thoughts would could cause this? Looks like the native addons from node_modules/@serialport/bindings-cpp/build/Release are not relocated to dist.

styfle avatar Apr 01 '22 21:04 styfle

Any news on this? Copying assets I find is a weak spot for ncc. How about adding the ability to specify hints/directives to ncc to help it with this?

rprovodenko avatar Jul 21 '22 12:07 rprovodenko