-
Notifications
You must be signed in to change notification settings - Fork 86
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
Conversation
… also in auto-installs
✅ Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-export-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for nextjs-plugin-custom-routes-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-i18next-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-plugin-edge-middleware ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-plugin-canary ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
@@ -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] })), '**', '*'), { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Description
If the Next Runtime is auto-installed, then
follow-redirects
(which is a dep ofnext-runtime
) won't be resolvable from.next
(thepublish
dir). This results in an error.To fix this, I'm adding
__dirname
as a second resolution starting point.__dirname
always points to a file within thenext-runtime
package, sofollow-redirects
should be resolvable from there.Previously discussed in https://netlify.slack.com/archives/C02T8ASK2E9/p1684318093610159.
Documentation
Tests
You can test this change yourself like so:
Relevant links (GitHub issues, etc.) or a picture of cute animal