Closed samchon closed 2 years ago
I unfortunately cannot reproduce this locally. The import path lines are generated as follows:
out.push(`import type { ${types.join(', ')} } from "../_types/${normalizeExternalFilePath(file.replace(/\\/g, '/'))}";`)
Where normalizeExternalFilePath
is:
export function normalizeExternalFilePath(importedFilePath: string): string {
importedFilePath = path.normalize(importedFilePath)
if (!importedFilePath.startsWith('../')) {
return importedFilePath
}
let level = 0
while (importedFilePath.startsWith('../')) {
level++
importedFilePath = importedFilePath.substr(3)
}
return `_external${level}/${importedFilePath}`
}
As you can see the path separator (/
) is never removed so I don't get why they don't appear in the generated SDK. I'll investigate to see if this is a platform-specific problem.
I just faced the same problem, so I think it is origin from that under Windows path.normalize() is working a bit different than:
I made a flow what is happening,
input to normalizeExternalFilePath: src/database/entities/chainData.entity
outoput from normalizeExternalFilePath: src\database\entities\chainData.entity
writen out to the generated file: import type { ChainData } from "../_types/src\database\entities\chainData.entity";
Which is modified by Prettier when it saved to:
import type { ChainData } from "../_types/srcdatabaseentitieschainData.entity";
Fixed by merging #7
All of paths written in the controller files are omitting the path separator.
For referece, my device is using the Windows.