Skip to content

fix: support appDir #1638

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 209 commits into from
Dec 12, 2022
Merged

fix: support appDir #1638

merged 209 commits into from
Dec 12, 2022

Conversation

ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Sep 23, 2022

Summary

⚠️ If you want to try this, see this discussion

Add support for Next 13 app dir. This should have no effect unless a user has enabled experimental.appDir in the next.config.js. Adds a test suite that has been ported from the e2e tests in the Next.js monorepo.

Known issues

The following are known issues:

Reviewing

Nothing in test needs review, so fear not: there are only about 8 actual source files that need reviewing.

Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal

pumpkin capybara

Standard checks:

  • Check the Deploy Preview's Demo site for your PR's functionality
  • Add docs when necessary

🧪 Once merged, make sure to update the version if needed and that it was published correctly.

@netlify
Copy link

netlify bot commented Sep 23, 2022

Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!

Name Link
🔨 Latest commit 7abc8b8
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/6396fbada4072600085ae1db
😎 Deploy Preview https://deploy-preview-1638--netlify-plugin-nextjs-nx-monorepo-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Sep 23, 2022

Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!

Name Link
🔨 Latest commit 7abc8b8
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/6396fbad61706400089d2859
😎 Deploy Preview https://deploy-preview-1638--netlify-plugin-nextjs-static-root-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Sep 23, 2022

Deploy Preview for netlify-plugin-nextjs-demo ready!

Name Link
🔨 Latest commit 886917e
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/634da5650d901a000ab4b9e3
😎 Deploy Preview https://deploy-preview-1638--netlify-plugin-nextjs-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Sep 23, 2022

Deploy Preview for next-hp-edge-demo ready!

Name Link
🔨 Latest commit ee77473
🔍 Latest deploy log https://app.netlify.com/sites/next-hp-edge-demo/deploys/633e9620e7fe3100088541a8
😎 Deploy Preview https://deploy-preview-1638--next-hp-edge-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Sep 23, 2022

Deploy Preview for next-plugin-rsc-demo ready!

Name Link
🔨 Latest commit 5b978bd
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-rsc-demo/deploys/63565a6d0c5b3100093423f4
😎 Deploy Preview https://deploy-preview-1638--next-plugin-rsc-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Sep 23, 2022

Deploy Preview for next-plugin-edge-middleware ready!

Name Link
🔨 Latest commit 7abc8b8
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-edge-middleware/deploys/6396fbad2248cf00080f1cd1
😎 Deploy Preview https://deploy-preview-1638--next-plugin-edge-middleware.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Sep 23, 2022

Deploy Preview for netlify-plugin-nextjs-export-demo ready!

Name Link
🔨 Latest commit 7abc8b8
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/6396fbad52f12500086bff6e
😎 Deploy Preview https://deploy-preview-1638--netlify-plugin-nextjs-export-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Sep 23, 2022

Deploy Preview for next-plugin-canary ready!

Name Link
🔨 Latest commit 7abc8b8
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-canary/deploys/6396fbad0dffab0008a3cf9b
😎 Deploy Preview https://deploy-preview-1638--next-plugin-canary.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Sep 23, 2022

Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!

Name Link
🔨 Latest commit 7abc8b8
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-next-auth-demo/deploys/6396fbad96898f00091f311f
😎 Deploy Preview https://deploy-preview-1638--netlify-plugin-nextjs-next-auth-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify

This comment was marked as outdated.

@netlify
Copy link

netlify bot commented Sep 23, 2022

Deploy Preview for next-i18next-demo ready!

Name Link
🔨 Latest commit 7abc8b8
🔍 Latest deploy log https://app.netlify.com/sites/next-i18next-demo/deploys/6396fbad29a13b0008d8a83d
😎 Deploy Preview https://deploy-preview-1638--next-i18next-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Sep 23, 2022

Deploy Preview for nextjs-plugin-custom-routes-demo ready!

Name Link
🔨 Latest commit 7abc8b8
🔍 Latest deploy log https://app.netlify.com/sites/nextjs-plugin-custom-routes-demo/deploys/6396fbad32d7f20009aa2b33
😎 Deploy Preview https://deploy-preview-1638--nextjs-plugin-custom-routes-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@ascorbic ascorbic force-pushed the mk/canary-demo branch 4 times, most recently from e6ef84b to baacc4d Compare September 23, 2022 15:52
Copy link
Contributor

@orinokai orinokai left a comment

Choose a reason for hiding this comment

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

Looks great, @ascorbic! I did a really thorough test today (partly as a learning exercise) of server/client components, static/dynamic rendering, static/dynamic paths and various revalidate/fallback options. All looks great and the tests do what they should. 🚀

const { host } = event.headers
const protocol = event.headers['x-forwarded-proto'] || 'http'
base = `${protocol}://${host}`
base = url.origin
Copy link
Contributor Author

Choose a reason for hiding this comment

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

origin is protocol://host:port

if (event.headers['x-middleware-prefetch'] && mode === 'ssr') {
return {
statusCode: 200,
body: '{}',
Copy link
Contributor Author

@ascorbic ascorbic Dec 12, 2022

Choose a reason for hiding this comment

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

Copy link
Contributor

@orinokai orinokai left a comment

Choose a reason for hiding this comment

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

Reviewed and tested and all looks great to me 🚀

@@ -201,6 +201,8 @@ export const getPrefetchResponse = (event: HandlerEvent, mode: string): HandlerR
headers: {
'Content-Type': 'application/json',
'x-middleware-skip': '1',
// https://github.com/vercel/next.js/pull/42936/files#r1027563953
vary: 'x-middleware-prefetch',
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch, what prompted the need for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd not hit the problem, but saw that user's comment when investigating the feature. I could see it being an issue at some point

Copy link

@nickytonline nickytonline left a comment

Choose a reason for hiding this comment

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

One dusty comment, but aside from that. 🚀

@@ -10,10 +10,10 @@ describe('Default site', () => {
cy.url().should('eq', `${Cypress.config().baseUrl}/`)
})

it('serves generated public files', async () => {
cy.request('service-worker.js').then((res) => {
it('serves generated public files', () => {

Choose a reason for hiding this comment

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

Is this test change related to the appDir work? Just trying to understand the connection between appDir work and removing a service worker call from the Nx demo project.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was failing tests

@kodiakhq kodiakhq bot merged commit a5b8047 into main Dec 12, 2022
@kodiakhq kodiakhq bot deleted the mk/canary-demo branch December 12, 2022 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: bug code to address defects in shipped code type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants