Open ItzRxg3 opened 7 months ago
Code that should fail after build
const pino = require('pino');
module.exports = pino({
timestamp: pino.stdTimeFunctions.isoTime,
base: undefined,
level: 'trace'
}, pino.transport({
targets: [
{
target: 'pino/file',
level: 'trace',
options: {
destination: `${process.cwd()}/latest.log`
},
},
{
ignore: "time,hostname,pid",
target: 'pino-pretty',
level: "debug",
translateTime: "dd-mm-yyyy, hh:MM:ss TT",
options: {}
}
],
}));
It's not a Bun bug, it happens because how Pino works internally with worker threads: https://github.com/pinojs/pino/blob/main/docs/bundling.md
nevermind, it's fixed after update of bun (at least latest version)
nevermind, it's fixed after update of bun (at least latest version)
It only works as long as you run in in the same environment as it was built in. Bun will resolve local paths and they get hardcoded into the bundle. Try bundling a small JS entrypoint with Pino and check the output.
I don't think it's possible to use the bundler plugin to include these files because the JS build API doesn't support --compile
option (or maybe it's just undocumented.)
oh really i see, bruh
What version of Bun is running?
1.1.3+2615dc742
What platform is your computer?
Microsoft Windows NT 10.0.19045.0 x64
What steps can reproduce the bug?
Sorry for bad english.
bun build app.js --compile --outfile app.exe --target bun
)What is the expected behavior?
Logger should work as normally and output text to console
What do you see instead?
5879 | } catch (err) { 5880 | continue; 5881 | } 5882 | } 5883 | if (!fixTarget2) { 5884 | throw new Error(
unable to determine transport target for "${origin}"
); ^ error: unable to determine transport target for "D:Programmingw-bun1.1.3 ode_modulespinolib\worker.js" at fixTarget (B:/~BUN/root/app.exe:5884:24) at transport (B:/~BUN/root/app.exe:5864:33) at B:/~BUN/root/app.exe:7537:20 at B:/~BUN/root/app.exe:2:47 at B:/~BUN/root/app.exe:7751:30 at B:/~BUN/root/app.exe:2:47 at B:/~BUN/root/app.exe:8048:86 at B:/~BUN/root/app.exe:2:47 at module code (B:/~BUN/root/app.exe:8275:27)Additional information
No response