Skip to content

Commit

Permalink
Fix ts configuration reoslving
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Nov 7, 2023
1 parent 56dd260 commit 33c7a67
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/build-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ function getBuildEnv(envs: string[]) {
return envVars
}

function buildInputConfig(
async function buildInputConfig(
entry: string,
pkg: PackageMetadata,
options: BundleOptions,
cwd: string,
{ tsConfigPath, tsCompilerOptions }: TypescriptOptions,
dts: boolean,
): InputOptions {
): Promise<InputOptions> {
const hasNoExternal = options.external === null
const externals = hasNoExternal
? []
Expand Down Expand Up @@ -124,9 +124,9 @@ function buildInputConfig(
// common plugins for both dts and ts assets that need to be processed
const commonPlugins = [sizePlugin]

let baseResolvedTsOptions
let baseResolvedTsOptions: TypescriptOptions['tsCompilerOptions'] | undefined
if (dts && useTypescript) {
baseResolvedTsOptions = convertCompilerOptions(cwd, {
baseResolvedTsOptions = (await convertCompilerOptions(cwd, {
declaration: true,
noEmit: false,
noEmitOnError: true,
Expand All @@ -139,7 +139,7 @@ function buildInputConfig(
module: 'esnext',
incremental: false,
jsx: tsCompilerOptions.jsx || 'react',
})
})).options
}

const plugins: Plugin[] = (
Expand Down Expand Up @@ -363,7 +363,7 @@ export async function buildEntryConfig(
return (await Promise.all(configs)).filter(nonNullable)
}

function buildConfig(
async function buildConfig(
entry: string,
pkg: PackageMetadata,
exportPaths: ExportPaths,
Expand All @@ -372,11 +372,11 @@ function buildConfig(
cwd: string,
tsOptions: TypescriptOptions,
dts: boolean,
): BuncheeRollupConfig {
): Promise<BuncheeRollupConfig> {
const { file } = bundleConfig
const useTypescript = Boolean(tsOptions.tsConfigPath)
const options = { ...bundleConfig, useTypescript }
const inputOptions = buildInputConfig(
const inputOptions = await buildInputConfig(
entry,
pkg,
options,
Expand Down

0 comments on commit 33c7a67

Please sign in to comment.