diff --git a/packages/next/build/webpack-config.ts b/packages/next/build/webpack-config.ts index b0dfa40c1b5e38c..7da4492c9667365 100644 --- a/packages/next/build/webpack-config.ts +++ b/packages/next/build/webpack-config.ts @@ -19,7 +19,6 @@ import { import { fileExists } from '../lib/file-exists' import { getPackageVersion } from '../lib/get-package-version' import { CustomRoutes } from '../lib/load-custom-routes.js' -import { getTypeScriptConfiguration } from '../lib/typescript/getTypeScriptConfiguration' import { CLIENT_STATIC_FILES_RUNTIME_AMP, CLIENT_STATIC_FILES_RUNTIME_MAIN, @@ -87,33 +86,6 @@ const devtoolRevertWarning = execOnce( let loggedSwcDisabled = false -function parseJsonFile(filePath: string) { - const JSON5 = require('next/dist/compiled/json5') - const contents = readFileSync(filePath, 'utf8') - - // Special case an empty file - if (contents.trim() === '') { - return {} - } - - try { - return JSON5.parse(contents) - } catch (err) { - if (!isError(err)) throw err - const codeFrame = codeFrameColumns( - String(contents), - { - start: { - line: (err as Error & { lineNumber?: number }).lineNumber || 0, - column: (err as Error & { columnNumber?: number }).columnNumber || 0, - }, - }, - { message: err.message, highlightCode: true } - ) - throw new Error(`Failed to parse "${filePath}":\n${codeFrame}`) - } -} - function getOptimizedAliases(): { [pkg: string]: string } { const stubWindowFetch = path.join(__dirname, 'polyfills', 'fetch', 'index.js') const stubObjectAssign = path.join(__dirname, 'polyfills', 'object-assign.js') @@ -232,8 +204,6 @@ export const NODE_BASE_ESM_RESOLVE_OPTIONS = { alias: false, } -let TSCONFIG_WARNED = false - export const nextImageLoaderRegex = /\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/i