Unverified Commit 92ea5635 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Development: Only require loadJsConfig when using webpack (#83623)

## What?

Don't require/call loadJsConfig when using Turbopack, as it's handled
internally. loadJsConfig is one of the places where TypeScript gets
loaded. There's still the TS verify as well, this narrows the amount of
places where TypeScript gets loaded to make it easier to remove that
loading of TypeScript in a future PR.
parent 5b1d8f8e
...@@ -19,7 +19,6 @@ import * as Log from '../../../build/output/log' ...@@ -19,7 +19,6 @@ import * as Log from '../../../build/output/log'
import { setGlobal } from '../../../trace/shared' import { setGlobal } from '../../../trace/shared'
import type { Telemetry } from '../../../telemetry/storage' import type { Telemetry } from '../../../telemetry/storage'
import type { IncomingMessage, ServerResponse } from 'http' import type { IncomingMessage, ServerResponse } from 'http'
import loadJsConfig from '../../../build/load-jsconfig'
import { createValidFileMatcher } from '../find-page-file' import { createValidFileMatcher } from '../find-page-file'
import { import {
EVENT_BUILD_FEATURE_USAGE, EVENT_BUILD_FEATURE_USAGE,
...@@ -763,16 +762,24 @@ async function startWatcher( ...@@ -763,16 +762,24 @@ async function startWatcher(
]) ])
} }
let tsconfigResult: let tsconfigResult:
| UnwrapPromise<ReturnType<typeof loadJsConfig>> | UnwrapPromise<
ReturnType<typeof import('../../../build/load-jsconfig').default>
>
| undefined | undefined
// This is not relevant for Turbopack because tsconfig/jsconfig is handled internally.
if (!hotReloader.turbopackProject) {
if (tsconfigChange) { if (tsconfigChange) {
try { try {
const loadJsConfig = (
require('../../../build/load-jsconfig') as typeof import('../../../build/load-jsconfig')
).default
tsconfigResult = await loadJsConfig(dir, nextConfig) tsconfigResult = await loadJsConfig(dir, nextConfig)
} catch (_) { } catch (_) {
/* do we want to log if there are syntax errors in tsconfig while editing? */ /* do we want to log if there are syntax errors in tsconfig while editing? */
} }
} }
}
if (hotReloader.turbopackProject) { if (hotReloader.turbopackProject) {
const hasRewrites = const hasRewrites =
......
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