We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
outExtension
When I map js files to cjs by using esbuild's outExtension: { '.js': '.cjs' } option, this plugin still generates js require calls
cjs
outExtension: { '.js': '.cjs' }
js
globalThis.__bundlerPathsOverrides = { ...globalThis.__bundlerPathsOverrides || {}, "thread-stream-worker": pinoBundlerAbsolutePath("./thread-stream-worker.js"), "pino-worker": pinoBundlerAbsolutePath("./pino-worker.js"), "pino-pipeline-worker": pinoBundlerAbsolutePath("./pino-pipeline-worker.js"), "pino/file": pinoBundlerAbsolutePath("./pino-file.js"), "pino-pretty": pinoBundlerAbsolutePath("./pino-pretty.js") };
The text was updated successfully, but these errors were encountered:
For now, I have resorted to using a rewrite hack…
import { build, type Plugin } from 'esbuild'; import esbuildPluginPino from 'esbuild-plugin-pino'; import { readFileSync, writeFileSync } from 'node:fs'; build({ entryPoints: ['src/server.ts'], outExtension: { '.js': '.cjs' }, outdir: 'build', // bundle: true, sourcemap: true, // format: 'cjs', platform: 'node', target: 'node19.6', // // minify: true, legalComments: 'none', define: { 'process.env.NODE_ENV': 'production' }, plugins: [ esbuildPluginPino({ transports: ['pino-pretty'], }) as any as Plugin, ], }) .then(() => { // renameSync('build/server.js', 'build/server.cjs'); let content = readFileSync('build/server.cjs', 'utf8'); content = content.replace( /pinoBundlerAbsolutePath\("(.*?)\.js"\)/g, 'pinoBundlerAbsolutePath("$1.cjs")' ); writeFileSync('build/server.cjs', content); }) .catch(() => process.exit(1));
…btw, you can also see that I had to type-cast the plugin because otherwise it gave me a type mismatch
Sorry, something went wrong.
No branches or pull requests
When I map js files to
cjs
by using esbuild'soutExtension: { '.js': '.cjs' }
option, this plugin still generatesjs
require callsThe text was updated successfully, but these errors were encountered: