diff --git a/lib/transport-stream.js b/lib/transport-stream.js index b152fc9ff..da864a9b7 100644 --- a/lib/transport-stream.js +++ b/lib/transport-stream.js @@ -13,7 +13,7 @@ module.exports = loadTransportStreamBuilder async function loadTransportStreamBuilder (target) { let fn try { - const toLoad = 'file://' + target + const toLoad = target.startsWith('file://') ? target : 'file://' + target if (toLoad.endsWith('.ts') || toLoad.endsWith('.cts')) { // TODO: add support for the TSM modules loader ( https://github.com/lukeed/tsm ). diff --git a/test/transport/core.test.js b/test/transport/core.test.js index ee5ef107c..b8af6738d 100644 --- a/test/transport/core.test.js +++ b/test/transport/core.test.js @@ -134,7 +134,7 @@ test('pino.transport with two files', async ({ same, teardown }) => { const transport = pino.transport({ targets: [{ level: 'info', - target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'), + target: 'file://' + join(__dirname, '..', 'fixtures', 'to-file-transport.js'), options: { destination: dest1 } }, { level: 'info',