Skip to content
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

compatibility fix #1254

Closed
wants to merge 1 commit into from
Closed

compatibility fix #1254

wants to merge 1 commit into from

Conversation

rokku-x
Copy link

@rokku-x rokku-x commented Dec 7, 2021

This will fix some incompatibility issues with some node.js use-cases by handling over the module loading to require. This patch is dependent also to the patches I made with the thread-stream and real-require.

resolves #1237

This will fix some incompatibility issues with some node.js use-cases by handling over the module loading to require. This patch is dependent also to the patches I made with the thread-stream and real-require.
Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide unit test to cover new and changed code.

@@ -13,6 +13,12 @@ module.exports = async function ({ targets }) {
targets = await Promise.all(targets.map(async (t) => {
let fn
try {
if(typeof process !== "undefined"){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the linting rules of this project.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can this condition happen?

@@ -13,6 +13,12 @@ module.exports = async function ({ targets }) {
targets = await Promise.all(targets.map(async (t) => {
let fn
try {
if(typeof process !== "undefined"){
//reuse the error code.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this comment referencing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am sorry. I meant that I reused the error code for the condition to match in the if statement catch clause.

@@ -13,6 +13,12 @@ module.exports = async function ({ targets }) {
targets = await Promise.all(targets.map(async (t) => {
let fn
try {
if(typeof process !== "undefined"){
//reuse the error code.
const err = new Error()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const err = new Error()
const err = Error()

Also, an appropriate message should be passed to the constructor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not emit Node core error codes

if(typeof process !== "undefined"){
//reuse the error code.
const err = new Error()
err.code = 'ERR_MODULE_NOT_FOUND';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this code appropriate for the condition?

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are needed

@rokku-x
Copy link
Author

rokku-x commented Jul 20, 2022

I was long away from from the project where I used this. I remembered it as someone proposed a better fix. I tried it and it was working. I should close this now.

@rokku-x rokku-x closed this Jul 20, 2022
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pino with transports not compatible with pkg
3 participants