Search terms
- "Try replacing Windows path separators"
- "did not match any files"
- "is not referenced by the 'files' or 'include' option in your tsconfig"
Expected Behavior
Can easily run typedoc on Windows file paths.
Actual Behavior
Most formats simply don't work.
First attempt (Windows path entry point)
typedoc --options typedoc.js with:
// typedoc.js
import {join} from 'node:path';
const indexTsFile = join(import.meta.dirname, 'src', 'index.ts');
export default {
entryPoints: [
indexTsFile
],
}
errors out with the following:
[warning] The glob ./src/index.ts did not match any files
[info] Try replacing Windows path separators (\) with posix path separators (/)
[error] Unable to find any entry points. See previous warnings
[error] Found 1 errors and 1 warnings
Second attempt (posix path entry point)
So I used node:path/posix instead:
// typedoc.js
import {join} from 'node:path/posix';
const indexTsFile = join(import.meta.dirname, 'src', 'index.ts');
export default {
entryPoints: [
indexTsFile
],
}
This errors out as well:
[warning] The glob ./src/index.ts did not match any files
[error] Unable to find any entry points. See previous warnings
[error] Found 1 errors and 1 warnings
Though this failure is not really typedoc's fault because this results in a path like C:\Users\electrovir\repo/src/index.ts since import.meta.dirname reports the path in Windows format.
Actual working version
After this I tried dozens of different path construction and conversion techniques. I finally ended up with one that works:
// typedoc.js
import { dirname, join } from 'node:path/posix';
import { fileURLToPath } from 'node:url';
const indexTsFile = join(dirname(fileURLToPath(import.meta.url)), 'src', 'index.ts');
export default {
entryPoints: [
indexTsFile
],
}
Steps to reproduce the bug
https://github.com/electrovir/typedoc-windows-path-issue/blob/dev/typedoc.js
Environment
- Typedoc version: 0.28.1
- TypeScript version: 5.8.2
- Node.js version: 22.12.0
- OS: Windows 11
Search terms
Expected Behavior
Can easily run typedoc on Windows file paths.
Actual Behavior
Most formats simply don't work.
First attempt (Windows path entry point)
typedoc --options typedoc.jswith:errors out with the following:
Second attempt (posix path entry point)
So I used
node:path/posixinstead:This errors out as well:
Though this failure is not really typedoc's fault because this results in a path like
C:\Users\electrovir\repo/src/index.tssinceimport.meta.dirnamereports the path in Windows format.Actual working version
After this I tried dozens of different path construction and conversion techniques. I finally ended up with one that works:
Steps to reproduce the bug
https://github.com/electrovir/typedoc-windows-path-issue/blob/dev/typedoc.js
Environment