-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
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
Cannot find module lib/worker.js #46
Comments
Renaming the files manually work, but isn't ideal:
const path = require('path');
const fs = require('fs');
const distPath = path.join(__dirname, 'dist');
require('esbuild')
.build(buildConfig)
.then((result) => {
fs.mkdirSync(distPath + '/lib');
fs.renameSync(distPath + '/thread-stream-worker.js', distPath + '/lib/worker.js');
fs.renameSync(distPath + '/thread-stream-worker.js.map', distPath + '/lib/worker.js.map');
fs.renameSync(distPath + '/pino-pretty.js', distPath + '/pino-pretty-transport.js');
fs.renameSync(distPath + '/pino-pretty.js.map', distPath + '/pino-pretty-transport.js.map');
console.log('Build completed');
process.exit(0);
}) |
Hey, should I open a PR and fix this? or is it supposed to work now? |
PR welcome! |
I only had to rename just one of the files so I admit that I don’t
completely understand the failure mode here.
What are the customEntrypoints in the current code?
…On Fri, Mar 24, 2023 at 18:35 David Peng ***@***.***> wrote:
PR welcome!
—
Reply to this email directly, view it on GitHub
<#46 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEC2ORJSXWWON6EZMNVJR3TW5ZDVZANCNFSM57BKMHLQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Renaming like that doesn't work if you use esbuild watch mode. This plugin just doesn't work without this renaming. Is anyone using it? |
Might be hitting: evanw/esbuild#2607? |
I also had it break when building import { defineConfig } from "tsup";
import pino from "esbuild-plugin-pino";
export default defineConfig({
entry: ["src/index.ts"],
target: "node20",
format: ["cjs", "esm"],
sourcemap: true,
esbuildPlugins: [pino({ transports: ["pino-pretty"] })],
}); I'm not sure what esbuild-plugin-pino/src/index.ts Lines 170 to 171 in 657397a
EDIT: Not caused by multiple formats, but by mutliple versions of pino resolved by esbuild, though tree-shaken so only one ends up in the output. |
I have
pino
(v8.4.1
) with the latestesbuild
and the associated transports as part of a package with TypeScript files (which are not compiled / built in the package itself) that is included in a project (ex:import { logger } from 'external-private-package/src/logger.ts
).We use
yarn
and require this package using"external-private-package": "link:<path>"
syntax to use it in thedependencies
ofpackage.json
.My
esbuild
config looks like this:When I build, I get the following structure:
But when I attempt to run the app using
node index.js
, I get the following:The text was updated successfully, but these errors were encountered: