From 9823923a39a715fc50b4a4ca4955b9b099bd6ceb Mon Sep 17 00:00:00 2001 From: "jj@jjsweb.site" Date: Mon, 16 Aug 2021 12:49:36 -0500 Subject: [PATCH] Add excludes to nft ignore --- packages/next/build/utils.ts | 4 ++-- .../webpack/plugins/next-trace-entrypoints-plugin.ts | 12 ++++++++++-- packages/next/types/index.d.ts | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/next/build/utils.ts b/packages/next/build/utils.ts index 304910c08f2a4a0..aae35e54d86a865 100644 --- a/packages/next/build/utils.ts +++ b/packages/next/build/utils.ts @@ -23,7 +23,7 @@ import { getRouteMatcher, getRouteRegex } from '../shared/lib/router/utils' import { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic' import escapePathDelimiters from '../shared/lib/router/utils/escape-path-delimiters' import { findPageFile } from '../server/lib/find-page-file' -import { GetStaticPaths } from 'next/types' +import { GetStaticPaths, PageConfig } from 'next/types' import { denormalizePagePath } from '../server/normalize-page-path' import { BuildManifest } from '../server/get-page-files' import { removePathTrailingSlash } from '../client/normalize-trailing-slash' @@ -927,7 +927,7 @@ export async function isPageStatic( } const isNextImageImported = (global as any).__NEXT_IMAGE_IMPORTED - const config = mod.config || {} + const config: PageConfig = mod.config || {} return { isStatic: !hasStaticProps && !hasGetInitialProps && !hasServerProps, isHybridAmp: config.amp === 'hybrid', diff --git a/packages/next/build/webpack/plugins/next-trace-entrypoints-plugin.ts b/packages/next/build/webpack/plugins/next-trace-entrypoints-plugin.ts index e96440d88846ed0..d8b8447ce3bb2a4 100644 --- a/packages/next/build/webpack/plugins/next-trace-entrypoints-plugin.ts +++ b/packages/next/build/webpack/plugins/next-trace-entrypoints-plugin.ts @@ -27,10 +27,18 @@ function getModuleFromDependency( export class TraceEntryPointsPlugin implements webpack.Plugin { private appDir: string private entryTraces: Map + private excludeFiles: string[] - constructor({ appDir }: { appDir: string }) { + constructor({ + appDir, + excludeFiles, + }: { + appDir: string + excludeFiles?: string[] + }) { this.appDir = appDir this.entryTraces = new Map() + this.excludeFiles = excludeFiles || [] } // Here we output all traced assets and webpack chunks to a @@ -223,7 +231,7 @@ export class TraceEntryPointsPlugin implements webpack.Plugin { readFile, readlink, stat, - ignore: TRACE_IGNORES, + ignore: [...TRACE_IGNORES, ...this.excludeFiles], }) const tracedDeps: string[] = [] diff --git a/packages/next/types/index.d.ts b/packages/next/types/index.d.ts index 0ce5a706cf63ba3..4abaab83eb3cf9f 100644 --- a/packages/next/types/index.d.ts +++ b/packages/next/types/index.d.ts @@ -80,8 +80,8 @@ export type PageConfig = { env?: Array unstable_runtimeJS?: false unstable_JsPreload?: false - unstable_includeFiles?: false - unstable_excludeFiles?: false + unstable_includeFiles?: string[] + unstable_excludeFiles?: string[] } export {