Skip to content

Commit

Permalink
feat: support customize typescript lib path
Browse files Browse the repository at this point in the history
fix #134
  • Loading branch information
qmhc committed Nov 7, 2022
1 parent 717af2f commit 27b83f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions example/vite.config.ts
Expand Up @@ -30,6 +30,7 @@ export default defineConfig({
},
plugins: [
dtsPlugin({
libFolderPath: '../node_modules/typescript/lib',
outputDir: ['dist', 'types'],
// include: ['src/index.ts'],
exclude: ['src/ignore'],
Expand Down
5 changes: 4 additions & 1 deletion src/plugin.ts
Expand Up @@ -54,6 +54,7 @@ export interface PluginOptions {
noEmitOnError?: boolean,
skipDiagnostics?: boolean,
logDiagnostics?: boolean,
libFolderPath?: string,
afterDiagnostic?: (diagnostics: Diagnostic[]) => void | Promise<void>,
beforeWriteFile?: (filePath: string, content: string) => void | false | TransformWriteFile,
afterBuild?: () => void | Promise<void>
Expand Down Expand Up @@ -88,6 +89,7 @@ export function dtsPlugin(options: PluginOptions = {}): Plugin {
skipDiagnostics = true,
logDiagnostics = false,
copyDtsFiles = true,
libFolderPath = undefined,
afterDiagnostic = noop,
beforeWriteFile = noop,
afterBuild = noop
Expand Down Expand Up @@ -215,7 +217,8 @@ export function dtsPlugin(options: PluginOptions = {}): Plugin {
emitDeclarationOnly: true
}),
tsConfigFilePath: tsConfigPath,
skipAddingFilesFromTsConfig: true
skipAddingFilesFromTsConfig: true,
libFolderPath: libFolderPath ? ensureAbsolute(libFolderPath, root) : undefined
})

allowJs = project.getCompilerOptions().allowJs ?? false
Expand Down

0 comments on commit 27b83f3

Please sign in to comment.