Skip to content

Commit

Permalink
fix: remove passing projectReferences to program
Browse files Browse the repository at this point in the history
fix #279
  • Loading branch information
qmhc committed Oct 27, 2023
1 parent 5488231 commit fc1209c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
27 changes: 16 additions & 11 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
import {
ensureAbsolute,
ensureArray,
fileTypesPath,
findTypesPath,
isNativeObj,
isRegExp,
normalizePath,
Expand Down Expand Up @@ -169,10 +169,13 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
: config.build.lib.entry

if (Array.isArray(input)) {
entries = input.reduce((prev, current) => {
prev[basename(current)] = current
return prev
}, {} as Record<string, string>)
entries = input.reduce(
(prev, current) => {
prev[basename(current)] = current
return prev
},
{} as Record<string, string>
)
} else {
entries = { ...input }
}
Expand Down Expand Up @@ -213,10 +216,13 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
const input = typeof options.input === 'string' ? [options.input] : options.input

if (Array.isArray(input)) {
entries = input.reduce((prev, current) => {
prev[basename(current)] = current
return prev
}, {} as Record<string, string>)
entries = input.reduce(
(prev, current) => {
prev[basename(current)] = current
return prev
},
{} as Record<string, string>
)
} else {
entries = { ...input }
}
Expand Down Expand Up @@ -314,7 +320,6 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
program = createProgram({
host,
rootNames,
projectReferences: content?.projectReferences,
options: compilerOptions
})

Expand Down Expand Up @@ -565,7 +570,7 @@ export function dtsPlugin(options: PluginOptions = {}): import('vite').Plugin {
} catch (e) {}

const entryNames = Object.keys(entries)
const types = fileTypesPath(pkg.publishConfig, pkg)
const types = findTypesPath(pkg.publishConfig, pkg)
const multiple = entryNames.length > 1

const cleanPath = (path: string) => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ export function toCapitalCase<T extends string>(value: T) {
) as CapitalCase<T>
}

export function fileTypesPath(...pkgs: Record<any, any>[]) {
export function findTypesPath(...pkgs: Record<any, any>[]) {
let path: string

for (const pkg of pkgs) {
Expand Down

0 comments on commit fc1209c

Please sign in to comment.