Skip to content
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

Skip creating virtual app client entry for pages #41000

Merged
merged 2 commits into from Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -96,6 +96,9 @@ export class FlightClientEntryPlugin {
}) => void
) {
for (const [name, entry] of compilation.entries.entries()) {
// Skip for entries under pages/
if (name.startsWith('pages/')) continue

// Check if the page entry is a server component or not.
const entryDependency: webpack.NormalModule | undefined =
entry.dependencies?.[0]
Expand Down
40 changes: 40 additions & 0 deletions test/e2e/app-dir/app-edge.test.ts
@@ -0,0 +1,40 @@
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { renderViaHTTP } from 'next-test-utils'
import path from 'path'

describe('app-dir edge SSR', () => {
if ((global as any).isNextDeploy) {
it('should skip next deploy for now', () => {})
return
}

if (process.env.NEXT_TEST_REACT_VERSION === '^17') {
it('should skip for react v17', () => {})
return
}

let next: NextInstance

beforeAll(async () => {
next = await createNext({
files: new FileRef(path.join(__dirname, 'app-edge')),
dependencies: {
react: 'experimental',
'react-dom': 'experimental',
typescript: 'latest',
'@types/react': 'latest',
'@types/node': 'latest',
},
})
})
afterAll(() => next.destroy())

it('should handle edge only routes', async () => {
const appHtml = await renderViaHTTP(next.url, '/app-edge')
expect(appHtml).toContain('<p>app-edge-ssr</p>')

const pageHtml = await renderViaHTTP(next.url, '/pages-edge')
expect(pageHtml).toContain('<p>pages-edge-ssr</p>')
})
})
4 changes: 4 additions & 0 deletions test/e2e/app-dir/app-edge/app/app-edge/page.tsx
@@ -0,0 +1,4 @@
export default function Page() {
return <p>app-edge-ssr</p>
}
export const config = { runtime: 'experimental-edge' }
8 changes: 8 additions & 0 deletions test/e2e/app-dir/app-edge/app/layout.tsx
@@ -0,0 +1,8 @@
export default function Root({ children }: { children: React.ReactNode }) {
return (
<html>
<head></head>
<body>{children}</body>
</html>
)
}
7 changes: 7 additions & 0 deletions test/e2e/app-dir/app-edge/next.config.js
@@ -0,0 +1,7 @@
module.exports = {
experimental: {
appDir: true,
legacyBrowsers: false,
browsersListForSwc: true,
},
}
5 changes: 5 additions & 0 deletions test/e2e/app-dir/app-edge/pages/pages-edge.tsx
@@ -0,0 +1,5 @@
export default function Page() {
return <p>pages-edge-ssr</p>
}

export const config = { runtime: 'experimental-edge' }
24 changes: 24 additions & 0 deletions test/e2e/app-dir/app-edge/tsconfig.json
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"target": "ES6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"paths": {
"@/ui/*": ["ui/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}