Unverified Commit 5a50a998 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Drop legacy RSC server and client extension (#40692)

Drop the support for `.server.js` and `.client.js` extension in RSC, only consume the pages with configured file extensions as page entry
parent 35098a14
......@@ -702,16 +702,6 @@ function assignDefaults(userConfig: { [key: string]: any }) {
}
}
if (result.experimental?.serverComponents) {
const pageExtensions: string[] = []
;(result.pageExtensions || []).forEach((ext) => {
pageExtensions.push(ext)
pageExtensions.push(`server.${ext}`)
pageExtensions.push(`client.${ext}`)
})
result.pageExtensions = pageExtensions
}
if (result.devIndicators?.buildActivityPosition) {
const { buildActivityPosition } = result.devIndicators
const allowedValues = [
......
export default function Page() {
return <h1 id="result-page">Result Page</h1>
}
export default function Page() {
return <p>This file won't be treated as entry page file</p>
}
......@@ -161,6 +161,14 @@ describe('Switchable runtime', () => {
)
})
it('should not consume server.js file extension', async () => {
const { status } = await fetchViaHTTP(
context.appPort,
'/legacy-extension'
)
expect(status).toBe(404)
})
it('should build /api/hello and /api/edge as an api route with edge runtime', async () => {
let response = await fetchViaHTTP(context.appPort, '/api/hello')
let text = await response.text()
......@@ -216,7 +224,7 @@ describe('Switchable runtime', () => {
export const config = {
runtime: 'experimental-edge',
}
export default () => new Response('edge response')
`
)
......@@ -246,7 +254,7 @@ describe('Switchable runtime', () => {
export const config = {
runtime: 'experimental-edge',
}
export default () => new Response('edge response again')
`
)
......@@ -327,7 +335,7 @@ describe('Switchable runtime', () => {
export const config = {
runtime: 'experimental-edge',
}
export default () => new Response('edge response')
`
)
......@@ -360,7 +368,7 @@ describe('Switchable runtime', () => {
export const config = {
runtime: 'experimental-edge',
}
export default => new Response('edge response')
`
)
......@@ -378,7 +386,7 @@ describe('Switchable runtime', () => {
export const config = {
runtime: 'experimental-edge',
}
`
)
await check(
......@@ -400,7 +408,7 @@ describe('Switchable runtime', () => {
export default function Page() {
return <p>Hello from page with invalid type</p>
}
export const config = {
runtime: 10,
}
......@@ -421,7 +429,7 @@ describe('Switchable runtime', () => {
export default function Page() {
return <p>Hello from page with invalid runtime</p>
}
export const config = {
runtime: "asd"
}
......@@ -442,11 +450,11 @@ describe('Switchable runtime', () => {
export default function Page() {
return <p>Hello from page without errors</p>
}
export const config = {
runtime: 'experimental-edge',
}
`
)
await check(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment