Skip to content

Commit

Permalink
Fix included flight manifest on node runtime (vercel#34113)
Browse files Browse the repository at this point in the history
We need to switch to json flight manifest on node deployment for RSC
  • Loading branch information
huozhi authored and natew committed Feb 16, 2022
1 parent 02accdd commit 108287b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/next/build/index.ts
Expand Up @@ -570,7 +570,12 @@ export default async function build(
PRERENDER_MANIFEST,
path.join(SERVER_DIRECTORY, MIDDLEWARE_MANIFEST),
hasServerComponents
? path.join(SERVER_DIRECTORY, MIDDLEWARE_FLIGHT_MANIFEST + '.js')
? path.join(
SERVER_DIRECTORY,
MIDDLEWARE_FLIGHT_MANIFEST + runtime === 'edge'
? '.js'
: '.json'
)
: null,
REACT_LOADABLE_MANIFEST,
config.optimizeFonts
Expand Down
Expand Up @@ -146,7 +146,7 @@ describe('Edge runtime - prod', () => {
await killApp(context.server)
})

it('should generate rsc middleware manifests', async () => {
it('should generate middleware SSR manifests for edge runtime', async () => {
const distServerDir = join(distDir, 'server')
const hasFile = (filename) => fs.existsSync(join(distServerDir, filename))

Expand Down Expand Up @@ -246,6 +246,24 @@ const nodejsRuntimeBasicSuite = {
runTests: (context, env) => {
basic(context, env)
streaming(context)

if (env === 'prod') {
it('should generate middleware SSR manifests for Node.js', async () => {
const distServerDir = join(distDir, 'server')
const hasFile = (filename) =>
fs.existsSync(join(distServerDir, filename))

const files = [
'middleware-build-manifest.js',
'middleware-flight-manifest.json',
'middleware-manifest.json',
]
files.forEach((file) => {
if (!hasFile(file)) console.log(file)
expect(hasFile(file)).toBe(true)
})
})
}
},
beforeAll: () => nextConfig.replace("runtime: 'edge'", "runtime: 'nodejs'"),
afterAll: () => nextConfig.restore(),
Expand Down

0 comments on commit 108287b

Please sign in to comment.