diff --git a/packages/next/src/build/type-check.ts b/packages/next/src/build/type-check.ts index c8c18352311da..4d5fa4008ec6a 100644 --- a/packages/next/src/build/type-check.ts +++ b/packages/next/src/build/type-check.ts @@ -4,7 +4,7 @@ import type { Span } from '../trace' import path from 'path' import * as Log from './output/log' -import { Worker as JestWorker } from 'next/dist/compiled/jest-worker' +import { Worker } from '../lib/worker' import { verifyAndLint } from '../lib/verifyAndLint' import createSpinner from './spinner' import { eventTypeCheckCompleted } from '../telemetry/events' @@ -30,20 +30,18 @@ function verifyTypeScriptSetup( hasAppDir: boolean, hasPagesDir: boolean ) { - const typeCheckWorker = new JestWorker( + const typeCheckWorker = new Worker( require.resolve('../lib/verify-typescript-setup'), { + exposedMethods: ['verifyTypeScriptSetup'], numWorkers: 1, enableWorkerThreads, maxRetries: 0, } - ) as JestWorker & { + ) as Worker & { verifyTypeScriptSetup: typeof import('../lib/verify-typescript-setup').verifyTypeScriptSetup } - typeCheckWorker.getStdout().pipe(process.stdout) - typeCheckWorker.getStderr().pipe(process.stderr) - return typeCheckWorker .verifyTypeScriptSetup({ dir, diff --git a/packages/next/src/lib/verifyAndLint.ts b/packages/next/src/lib/verifyAndLint.ts index c56ee8f5d1f69..80a1be496df1f 100644 --- a/packages/next/src/lib/verifyAndLint.ts +++ b/packages/next/src/lib/verifyAndLint.ts @@ -1,5 +1,5 @@ import { red } from './picocolors' -import { Worker } from 'next/dist/compiled/jest-worker' +import { Worker } from './worker' import { existsSync } from 'fs' import { join } from 'path' import { ESLINT_DEFAULT_DIRS } from './constants' @@ -23,6 +23,7 @@ export async function verifyAndLint( try { lintWorkers = new Worker(require.resolve('./eslint/runLintCheck'), { + exposedMethods: ['runLintCheck'], numWorkers: 1, enableWorkerThreads, maxRetries: 0, @@ -30,9 +31,6 @@ export async function verifyAndLint( runLintCheck: typeof import('./eslint/runLintCheck').runLintCheck } - lintWorkers.getStdout().pipe(process.stdout) - lintWorkers.getStderr().pipe(process.stderr) - const lintDirs = (configLintDirs ?? ESLINT_DEFAULT_DIRS).reduce( (res: string[], d: string) => { const currDir = join(dir, d)