vercel / ncc

Compile a Node.js project into a single file. Supports TypeScript, binary addons, dynamic requires.
https://npmjs.com/@vercel/ncc
MIT License
9.23k stars 287 forks source link

Support for pino transports? #1049

Open yorch opened 1 year ago

yorch commented 1 year ago

Pino is a logger that has the concept of transports, that are started in a worker thread, so the transports (which can be other packages) are not directly import by the code, but just referenced by name. For instance:

const pino = require('pino')
const transport = pino.transport({
  target: 'pino-pretty',
  options: { destination: 1 } // use 2 for stderr
})
pino(transport)

Being pino-pretty another NPM package.

More info: https://github.com/pinojs/pino/blob/master/docs/transports.md#transports

After compiling a project and trying to run the compiled version, Pino cannot obviously find the used transports (ie: pino-pretty).

Any idea on how to support this or work around it?

Thanks

styfle commented 1 year ago

There's a similar issue #794 that suggested --asset-builds flag

yorch commented 1 year ago

@styfle did it work for you? I tried it before creating the issue but couldn't make it work

ghost commented 1 year ago

--asset-builds didnt work for me either with pino, so i just it as externals while playing around.

It also doesn't show up in the help text at all as per the readme. I went back through the last few releases and it has never showed up in in the help text even I think in the one in which it was introduced, so it's probably more of a UI oversight in that case.