Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复window环境无法生成definition.json文件 #14958

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/taro-platform-h5/build/utils/ast.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'path'
import ts from 'typescript'

export interface DocEntry {
Expand Down Expand Up @@ -30,10 +31,9 @@ export function generateDocumentation (

for (const sourceFile of program.getSourceFiles()) {
if (param.withDeclaration !== false || !sourceFile.isDeclarationFile) {
if (
(param.mapAll === true && filepaths.includes(sourceFile.fileName))
|| sourceFile.fileName === filepaths[0]
) {
// 规范化路径,修复window环境无法生成definition.json文件
const normalSrcFile = path.normalize(sourceFile.fileName)
if ((param.mapAll === true && filepaths.includes(normalSrcFile)) || normalSrcFile === path.normalize(filepaths[0])) {
ts.forEachChild(sourceFile, (n) => visitAST(n, output))
}
}
Expand Down