Skip to content

fix: resolve follow-redirects from runtime package #2124

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

Merged
merged 1 commit into from
May 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/runtime/src/helpers/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ const traceNextServer = async (publish: string): Promise<string[]> => {

export const traceNPMPackage = async (packageName: string, publish: string) => {
try {
return await glob(join(dirname(require.resolve(packageName, { paths: [publish] })), '**', '*'), {
return await glob(join(dirname(require.resolve(packageName, { paths: [__dirname, publish] })), '**', '*'), {
Copy link

Choose a reason for hiding this comment

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

Are we sure this file is exectued as commonjs and not ESM? because __dirname is only available in commonjs.

Copy link

Choose a reason for hiding this comment

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

Okay I see that __dirname is also used on other locations in this file.

Copy link
Member

Choose a reason for hiding this comment

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

It better be, because require.resolve is also absent from ESM.

absolute: true,
})
} catch (error) {
Expand Down