ts-node
ts-node copied to clipboard
Does not support modulesuffixes in tsconfig.json
trafficstars
Search Terms
We use https://www.typescriptlang.org/tsconfig#moduleSuffixes for react-native project.
Adding this config option causes ts-node to break, is there a way to avoid this?
Expected Behavior
ts-node should not crash
Actual Behavior
$ ts-node ./scripts/i18n/build-i18n.ts
/bitrise/src/node_modules/ts-node/src/index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
error TS5023: Unknown compiler option 'moduleSuffixes'.
at createTSError (/bitrise/src/node_modules/ts-node/src/index.ts:859:12)
at reportTSError (/bitrise/src/node_modules/ts-node/src/index.ts:863:19)
at createFromPreloadedConfig (/bitrise/src/node_modules/ts-node/src/index.ts:874:36)
at phase4 (/bitrise/src/node_modules/ts-node/src/bin.ts:543:44)
at bootstrap (/bitrise/src/node_modules/ts-node/src/bin.ts:95:10)
at main (/bitrise/src/node_modules/ts-node/src/bin.ts:55:10)
at Object.<anonymous> (/bitrise/src/node_modules/ts-node/src/bin.ts:800:3)
at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32) {
diagnosticCodes: [ 5023 ]
}
Steps to reproduce the problem
Create a project with moduleSuffixes compiler option.
Minimal reproduction
Specifications
- ts-node version:
10.9.1 - node version:
18.3.0 - TypeScript version: 4.7.4
- tsconfig.json, if you're using one:
{
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"lib": ["es6"],
"allowJs": true,
"jsx": "react-native",
"noEmit": true,
"isolatedModules": true,
"strict": true,
"moduleResolution": "node",
"baseUrl": "./",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"moduleSuffixes": [".ios", ".android", ".native", ""],
"paths": {
"@app/*": ["./app/*"],
"@lib/*": ["./app/lib/*"],
"@assets/*": ["./assets/*"],
"@hooks/*": ["./app/hooks/*"],
"@modules/*": ["./app/modules/*"],
"@utilities/*": ["./app/utilities/*"]
}
},
"exclude": [
"./node_modules",
"./node_modules",
"babel.config.js",
"metro.config.js",
"./jest.config.js"
]
}
- package.json:
{}
- Operating system and version: 13.5.1 (22G90)
- If Windows, are you using WSL or WSL2?: No
error TS5023: Unknown compiler option 'moduleSuffixes'.
That error comes from the TypeScript compiler. You can check the version of TS that ts-node is using:
ts-node -vvv