mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
### What Change from processing the file with `next-metatdata-route-loader` directly into passing the file as loader query, and leave an empty resource file for it. This will resolve the error that users were seeing with `manifest.json` convention. ``` Import trace for requested module: ../../../../packages/next/dist/build/webpack/loaders/next-metadata-route-loader.js?page=%2Fmanifest.jso n%2Froute&isDynamic=0!./app/manifest.json?__next_metadata_route__ getStaticAssetRouteCode page /manifest.json/route this.resourcePath /Users/huozhi/workspace/next.js/tes t/e2e/app-dir/metadata-json-manifest/app/manifest.json ``` ### Why I looked at the loader process that the final resource processed by webpack is `json!next-metadata-route-loader...`, which means the builtin json loader processing json file after the metadata route loader. I didn't get chance to solve the ordering issue, so I changed the resourcePath to empty "", and pass the file path as query into the loader to avoid json-loader processing it after transpilation. Fixes #59923 Closes NEXT-2630 Closes NEXT-2439
23 lines
588 B
TypeScript
23 lines
588 B
TypeScript
import { createNextDescribe } from 'e2e-utils'
|
|
|
|
createNextDescribe(
|
|
'app-dir metadata-json-manifest',
|
|
{
|
|
files: __dirname,
|
|
skipDeployment: true,
|
|
},
|
|
({ next }) => {
|
|
it('should support metadata.json manifest', async () => {
|
|
const response = await next.fetch('/manifest.json')
|
|
expect(response.status).toBe(200)
|
|
const json = await response.json()
|
|
expect(json).toEqual({
|
|
name: 'My Next.js Application',
|
|
short_name: 'Next.js App',
|
|
description: 'An application built with Next.js',
|
|
start_url: '/',
|
|
})
|
|
})
|
|
}
|
|
)
|