Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ const resourceUrl = new URL(import.meta.url)
const filePath = fileURLToPath(resourceUrl).replace(${JSON.stringify(
METADATA_RESOURCE_QUERY
)}, '')
const buffer = fs.readFileSync(filePath)

let buffer
export function GET() {
if (!buffer) { buffer = fs.readFileSync(filePath) }
return new NextResponse(buffer, {
headers: {
'Content-Type': contentType,
Expand Down
Binary file not shown.
14 changes: 14 additions & 0 deletions test/production/standalone-mode/metadata/app/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions test/production/standalone-mode/metadata/app/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default function Root({ children }) {
return (
<html>
<head></head>
<body>{children}</body>
</html>
)
}
3 changes: 3 additions & 0 deletions test/production/standalone-mode/metadata/app/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function page() {
return 'page'
}
22 changes: 22 additions & 0 deletions test/production/standalone-mode/metadata/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { createNextDescribe } from 'e2e-utils'

createNextDescribe(
'standalone mode - metadata routes',
{
files: __dirname,
},
({ next }) => {
beforeAll(async () => {
// Hide source files to make sure route.js can read files from source
// in order to hit the prerender cache
await next.renameFolder('app', 'app_hidden')
})

it('should work', async () => {
const faviconRes = await next.fetch('/favicon.ico')
const iconRes = await next.fetch('/icon.svg')
expect(faviconRes.status).toBe(200)
expect(iconRes.status).toBe(200)
})
}
)
6 changes: 6 additions & 0 deletions test/production/standalone-mode/metadata/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
output: 'standalone',
experimental: {
appDir: true,
},
}