-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix: correctly pass resolvedBaseUrl for Next.js 13.2.0+ #26399
Conversation
3 flaky tests on run #45231 ↗︎
Details:
cypress/e2e/cypress/cypress.cy.js • 3 flaky tests • 5x-driver-electron
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
jsConfig: jsConfigResult.jsConfig, | ||
// Required for Next.js > 13.2.0 to respect tsconfig.compilerOptions.baseUrl | ||
resolvedBaseUrl: jsConfigResult.resolvedBaseUrl, |
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.
This is the fix. We could do ...jsConfigResult
, but we don't know exactly what else is there (can change at any time), I think this is probably more explicit and maintainable.
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.
Nice work tracking this down ! 🥳
Two thoughts on the changelog entry:
- Should it reference "in Component Testing projects" just to be more explicit?
- Component testing broken with NextJS 13.2.1 #25951 is already referenced in the 12.8.0 changelog - should we add wording around "completed an edge case not covered in our original fix" or something to that effect?
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.
LGTM. Great job tracking this down @lmiller1990
@mike-plummer good idea, I updated the changelog. |
…6399) * add test project * styles * pass resolvedBaseUrl * make project more minimal * build binaries * changelog * remove css * pass supportedBrowsers to next webpack config * handle case of missing getSupportedBrowsers function * add default function
Additional details
As of v13.1.7-canary.7, Next.js projects setting
baseUrl
to anything other than the default"."
would not correctly resolve modules.Diff: vercel/next.js@v13.1.7-canary.6...v13.1.7-canary.7. Lots of files but mostly static content. Here's the exact line that broke us.
info
containsinfo.resolvedBaseUrl
, which we are currently not passing. I updated our nextHandler to include theresolvedBaseUrl
, and it works. I added a regression test, too.Steps to test
You could simply revert the fix I made and run the system test - it will fail. Alternatively, you could make a new Next project, change
baseUrl
tosrc
, then update some imports to removesrc
- egimport 'src/styles/global.css'
would becomeimport 'styles/global.css'
, which is allowed since you've now got"baseUrl": "src"
.How has the user experience changed?
It respects
baseUrl
and works as expected.PR Tasks
cypress-documentation
?type definitions
?