Skip to content

Commit

Permalink
fix: resolve module preserve to esnext for rollup
Browse files Browse the repository at this point in the history
fix #358
  • Loading branch information
qmhc committed Aug 6, 2024
1 parent da4af65 commit 710400a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import { resolve } from 'node:path'
import { Extractor, ExtractorConfig } from '@microsoft/api-extractor'
import { tryGetPkgPath } from './utils'

import type ts from 'typescript'
import type { ExtractorLogLevel, IExtractorInvokeOptions } from '@microsoft/api-extractor'
import type { RollupConfig } from './types'

export interface BundleOptions {
root: string,
configPath?: string,
compilerOptions: ts.CompilerOptions,
compilerOptions: Record<string, any>,
outDir: string,
entryPath: string,
fileName: string,
Expand Down Expand Up @@ -38,6 +37,11 @@ export function rollupDeclarationFiles({
fileName += '.d.ts'
}

// Refer to https://github.com/microsoft/rushstack/issues/4863
if (/preserve/i.test(compilerOptions.module)) {
compilerOptions = { ...compilerOptions, module: 'ESNext' }
}

const extractorConfig = ExtractorConfig.prepare({
configObject: {
...rollupConfig,
Expand Down

0 comments on commit 710400a

Please # to comment.