Skip to content

Commit

Permalink
feat: respect outExtension option from esbuild (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkhg authored Oct 28, 2023
1 parent 4e4f107 commit 90ed134
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default function esbuildPluginPino({
const pino = path.dirname(require.resolve('pino'))
const threadStream = path.dirname(require.resolve('thread-stream'))

const { entryPoints, outbase } = currentBuild.initialOptions
const { entryPoints, outbase, outExtension } = currentBuild.initialOptions
/** Pino and worker */
const customEntrypoints: Record<string, string> = {
'thread-stream-worker': path.join(threadStream, 'lib/worker.js'),
Expand Down Expand Up @@ -193,6 +193,11 @@ export default function esbuildPluginPino({
}
}
`

let extension = '.js'
if(outExtension && outExtension['.js']){
extension = outExtension['.js']
}
const pinoOverrides = Object.keys({
...customEntrypoints,
...transportsEntrypoints
Expand All @@ -201,7 +206,7 @@ export default function esbuildPluginPino({
(id) =>
`'${
id === 'pino-file' ? 'pino/file' : id
}': pinoBundlerAbsolutePath('./${id}.js')`
}': pinoBundlerAbsolutePath('./${id}${extension}')`
)
.join(',')

Expand Down

0 comments on commit 90ed134

Please sign in to comment.