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

Enable dynamic HTML in minimal mode #34222

Merged
merged 5 commits into from Feb 11, 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
3 changes: 1 addition & 2 deletions packages/next/server/base-server.ts
Expand Up @@ -289,7 +289,7 @@ export default abstract class Server {
} = this.nextConfig

this.buildId = this.getBuildId()
this.minimalMode = minimalMode
this.minimalMode = minimalMode || !!process.env.NEXT_PRIVATE_MINIMAL_MODE

const serverComponents = this.nextConfig.experimental.serverComponents
this.serverComponentManifest = serverComponents
Expand Down Expand Up @@ -1162,7 +1162,6 @@ export default abstract class Server {
!isSSG &&
!isLikeServerless &&
!query.amp &&
!this.minimalMode &&
typeof components.Document?.getInitialProps !== 'function'
}

Expand Down
44 changes: 44 additions & 0 deletions test/production/react-18-streaming-ssr/index.test.ts
@@ -0,0 +1,44 @@
import { createNext } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { renderViaHTTP } from 'next-test-utils'

describe('react-18-streaming-ssr in minimal mode', () => {
let next: NextInstance

beforeAll(async () => {
process.env.NEXT_PRIVATE_MINIMAL_MODE = '1'
huozhi marked this conversation as resolved.
Show resolved Hide resolved

next = await createNext({
files: {
'pages/index.server.js': `
export default function Page() {
return <p>static streaming</p>
}
`,
},
nextConfig: {
experimental: {
reactRoot: true,
serverComponents: true,
runtime: 'nodejs',
},
},
dependencies: {
react: '18.0.0-rc.0',
'react-dom': '18.0.0-rc.0',
},
skipStart: true,
})

await next.start()
})
afterAll(() => {
delete process.env.NEXT_PRIVATE_MINIMAL_MODE
next.destroy()
})

it('should generate html response by streaming correctly', async () => {
const html = await renderViaHTTP(next.url, '/')
expect(html).toContain('static streaming')
})
})