Skip to content

DocumentProps without files: breaking change in 9.5.3? #16784

Answered by bobaaaaa
bobaaaaa asked this question in Help
Discussion options

You must be logged in to vote

Because nobody of the nextjs core team answered my question: Here is our workaround. It's the same impl. @Timer used in the related PR.

import { getPageFiles } from 'next/dist/next-server/server/get-page-files';
import type { BuildManifest } from 'next/dist/next-server/server/get-page-files';

type DocumentFiles = {
  sharedFiles: readonly string[];
  pageFiles: readonly string[];
  allFiles: readonly string[];
};

function getDocumentFiles(buildManifest: BuildManifest, pathname: string): DocumentFiles {
  const sharedFiles: readonly string[] = getPageFiles(buildManifest, '/_app');
  const pageFiles: readonly string[] = pathname !== '/_error' ? getPageFiles(buildManifest, pathname) : [];
  

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@bobaaaaa
Comment options

@deadcoder0904
Comment options

Comment options

You must be logged in to vote
4 replies
@mandava
Comment options

@bobaaaaa
Comment options

@deadcoder0904
Comment options

@mandava
Comment options

Answer selected by bobaaaaa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #16784 on September 02, 2020 15:49.