Skip to content

fix: try to resolve next modules via multiple paths #479

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 9 commits into from
Jul 5, 2021
Merged

Conversation

ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Jul 5, 2021

Next.js recently changed its directory structure, which broke our deep imports ( #475 ). This PR adds support to resolveNextModule for passing arrays of paths, to allow backward-compatible updates to paths like these. Meanwhile it also adds integration tests against next@canary to make this less likely to happen. We also have plans to add automatic tests against new canary releases.

Fixes #475

@github-actions github-actions bot added the type: bug code to address defects in shipped code label Jul 5, 2021
Copy link

@lindsaylevine lindsaylevine left a comment

Choose a reason for hiding this comment

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

awesome!!!

my only thought is that maybe we should add consts that indicate that
next/dist/next-server/... was < next 11.x (or whatever it was) and next/dist/server is >= canary ?

const loadConfig = require(resolveNextModule(
['next/dist/next-server/server/config', 'next/dist/server/config'],
cwd,
)).default

Choose a reason for hiding this comment

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

NICE

}
}

throw new Error(`Could not resolve Next module. Tried "${modules.join(', ')}"`)
}

Choose a reason for hiding this comment

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

ez

Copy link

@lindsaylevine lindsaylevine left a comment

Choose a reason for hiding this comment

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

!

@ascorbic ascorbic enabled auto-merge (squash) July 5, 2021 14:19
@ascorbic ascorbic merged commit 7d208c3 into main Jul 5, 2021
@ascorbic ascorbic deleted the fix/next-imports branch July 5, 2021 14:33
serhalp pushed a commit that referenced this pull request Jun 13, 2024
* Create e2e-report.yml

* remove cli install

* add secret + step for downlaod

* remove commented out schedule

* update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Next canary's changed directory structure breaks imports
2 participants