Unverified Commit c3543f8a authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

refactor(webpack-config): Pass through jsConfigPath (#75886)

Extracted from the try-ci-test work: #75443

I'm just trying to find small unobjectionable pieces we can get merged to get the size of the in-flight changeset down.

<!--
Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent 34e630bf
......@@ -49,6 +49,7 @@ export default async function loadJsConfig(
): Promise<{
useTypeScript: boolean
jsConfig: JsConfig
jsConfigPath?: string
resolvedBaseUrl: ResolvedBaseUrl
}> {
let typeScriptPath: string | undefined
......@@ -110,5 +111,10 @@ export default async function loadJsConfig(
useTypeScript,
jsConfig,
resolvedBaseUrl,
jsConfigPath: useTypeScript
? tsConfigPath
: fs.existsSync(jsConfigPath)
? jsConfigPath
: undefined,
}
}
......@@ -249,13 +249,18 @@ export async function loadProjectInfo({
dev: boolean
}): Promise<{
jsConfig: JsConfig
jsConfigPath?: string
resolvedBaseUrl: ResolvedBaseUrl
supportedBrowsers: string[] | undefined
}> {
const { jsConfig, resolvedBaseUrl } = await loadJsConfig(dir, config)
const { jsConfig, jsConfigPath, resolvedBaseUrl } = await loadJsConfig(
dir,
config
)
const supportedBrowsers = await getSupportedBrowsers(dir, dev)
return {
jsConfig,
jsConfigPath,
resolvedBaseUrl,
supportedBrowsers,
}
......@@ -291,6 +296,7 @@ export default async function getBaseWebpackConfig(
appDir,
middlewareMatchers,
jsConfig,
jsConfigPath,
resolvedBaseUrl,
supportedBrowsers,
clientRouterFilters,
......@@ -314,6 +320,7 @@ export default async function getBaseWebpackConfig(
middlewareMatchers?: MiddlewareMatcher[]
noMangling?: boolean
jsConfig: any
jsConfigPath?: string
resolvedBaseUrl: ResolvedBaseUrl
supportedBrowsers: string[] | undefined
edgePreviewProps?: Record<string, string>
......@@ -332,6 +339,8 @@ export default async function getBaseWebpackConfig(
const isEdgeServer = compilerType === COMPILER_NAMES.edgeServer
const isNodeServer = compilerType === COMPILER_NAMES.server
const isRspack = Boolean(process.env.NEXT_RSPACK)
// If the current compilation is aimed at server-side code instead of client-side code.
const isNodeOrEdgeCompilation = isNodeServer || isEdgeServer
......@@ -706,6 +715,13 @@ export default async function getBaseWebpackConfig(
plugins: [
isNodeServer ? new OptionalPeerDependencyResolverPlugin() : undefined,
].filter(Boolean) as webpack.ResolvePluginInstance[],
...((isRspack && jsConfigPath
? {
tsConfig: {
configFile: jsConfigPath,
},
}
: {}) as any),
}
// Packages which will be split into the 'framework' chunk.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment