Skip to content

Commit

Permalink
fix: manually collect compiler options for types rollup
Browse files Browse the repository at this point in the history
fix #297
  • Loading branch information
qmhc committed Jan 15, 2024
1 parent e8827cb commit 0d0b255
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/plugin.ts
Expand Up @@ -24,6 +24,7 @@ import {
ensureAbsolute,
ensureArray,
findTypesPath,
getTsConfig,
isNativeObj,
isRegExp,
normalizePath,
Expand Down Expand Up @@ -648,6 +649,9 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
}

const rollupFiles = new Set<string>()
const compilerOptions = configPath
? getTsConfig(configPath, host.readFile).compilerOptions
: rawCompilerOptions

if (multiple) {
for (const name of entryNames) {
Expand All @@ -656,7 +660,7 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
rollupDeclarationFiles({
root,
configPath,
compilerOptions: rawCompilerOptions,
compilerOptions,
outDir,
entryPath: path,
fileName: basename(path),
Expand All @@ -672,7 +676,7 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
rollupDeclarationFiles({
root,
configPath,
compilerOptions: rawCompilerOptions,
compilerOptions,
outDir,
entryPath: typesPath,
fileName: basename(typesPath),
Expand Down

0 comments on commit 0d0b255

Please sign in to comment.