ncc
ncc copied to clipboard
ncc vs Serialport Part 2 - missing binaries (assets)
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).
- yarn init -y
- yarn add serialport
- file
index.cjs
const SerialPort = require('serialport')
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
@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.
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?