Skip to content

Commit

Permalink
Fix compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens committed Feb 12, 2024
1 parent d82a6a1 commit 2b6679c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
5 changes: 3 additions & 2 deletions packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ import { hasCustomExportOutput } from '../export/utils'
import { interopDefault } from '../lib/interop-default'
import { formatDynamicImportPath } from '../lib/format-dynamic-import-path'
import { isInterceptionRouteAppPath } from '../server/future/helpers/interception-routes'
import { getTurbopackJsConfig } from '../server/dev/turbopack-utils'
import { buildCustomRoute } from '../lib/build-custom-route'
import { getTurbopackJsConfig } from '../server/dev/hot-reloader-turbopack'

interface ExperimentalBypassForInfo {
experimentalBypassFor?: RouteHas[]
Expand Down Expand Up @@ -1309,7 +1309,7 @@ export default async function build(
return serverFilesManifest
})

async function turbopackBuild(): Promise<void> {
async function turbopackBuild(): Promise<never> {
if (!process.env.TURBOPACK || !process.env.TURBOPACK_BUILD) {
throw new Error("next build doesn't support turbopack yet")
}
Expand Down Expand Up @@ -1342,6 +1342,7 @@ export default async function build(
const iter = project.entrypointsSubscribe()
// for await (const entrypoints of iter) {
// }
throw new Error("next build doesn't support turbopack yet")
}
let buildTraceContext: undefined | BuildTraceContext
let buildTracesPromise: Promise<any> | undefined = undefined
Expand Down
11 changes: 1 addition & 10 deletions packages/next/src/server/dev/hot-reloader-turbopack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {
getVersionInfo,
matchNextPageBundleRequest,
} from './hot-reloader-webpack'
import loadJsConfig from '../../build/load-jsconfig'
import { normalizeAppPath } from '../../shared/lib/router/utils/app-paths'
import { isInterceptionRouteRewrite } from '../../lib/generate-interception-routes-rewrites'
import { store as consoleStore } from '../../build/output/store'
Expand Down Expand Up @@ -79,6 +78,7 @@ import {
decodeMagicIdentifier,
} from '../../shared/lib/magic-identifier'
import {
getTurbopackJsConfig,
mergeActionManifests,
mergeAppBuildManifests,
mergeBuildManifests,
Expand All @@ -93,7 +93,6 @@ import {
type ServerFields,
type SetupOpts,
} from '../lib/router-utils/setup-dev-bundler'
import type { NextConfigComplete } from '../config-shared'

const MILLISECONDS_IN_NANOSECOND = 1_000_000
const wsServer = new ws.Server({ noServer: true })
Expand All @@ -105,14 +104,6 @@ const isTestMode = !!(

class ModuleBuildError extends Error {}

export async function getTurbopackJsConfig(
dir: string,
nextConfig: NextConfigComplete
) {
const { jsConfig } = await loadJsConfig(dir, nextConfig)
return jsConfig ?? { compilerOptions: {} }
}

function issueKey(issue: Issue): string {
return [
issue.severity,
Expand Down
10 changes: 10 additions & 0 deletions packages/next/src/server/dev/turbopack-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import type {
import type { PagesManifest } from '../../build/webpack/plugins/pages-manifest-plugin'
import type { AppBuildManifest } from '../../build/webpack/plugins/app-build-manifest-plugin'
import type { BuildManifest } from '../get-page-files'
import type { NextConfigComplete } from '../config-shared'
import loadJsConfig from '../../build/load-jsconfig'

export interface InstrumentationDefinition {
files: string[]
Expand Down Expand Up @@ -169,3 +171,11 @@ export function mergeLoadableManifests(manifests: Iterable<LoadableManifest>) {
}
return manifest
}

export async function getTurbopackJsConfig(
dir: string,
nextConfig: NextConfigComplete
) {
const { jsConfig } = await loadJsConfig(dir, nextConfig)
return jsConfig ?? { compilerOptions: {} }
}

0 comments on commit 2b6679c

Please sign in to comment.