Repository navigation
Closed
Description
I'm trying to get ts-node to behave as if there was no tsconfig in the current directory. Unless I'm misunderstanding the readme (https://github.com/TypeStrong/ts-node#loading-tsconfigjson), this should be possible...
in an empty directory:
PS C:\Users\aval\tsdev\nla\tsnodetest> echo "ERROR" > tsconfig.json
PS C:\Users\aval\tsdev\nla\tsnodetest> echo "console.log('foobar')" > index.ts
PS C:\Users\aval\tsdev\nla\tsnodetest> node -v
v8.7.0
PS C:\Users\aval\tsdev\nla\tsnodetest> npm -v
5.5.1
PS C:\Users\aval\tsdev\nla\tsnodetest> npm list ts-node -g
C:\npm
+-- ts-node@3.3.0
PS C:\Users\aval\tsdev\nla\tsnodetest> ts-node -P false .\index.ts
TypeError: The specified path does not exist: false
at resolveSync (C:\npm\node_modules\ts-node\node_modules\tsconfig\src\tsconfig.ts:72:9)
at Object.loadSync (C:\npm\node_modules\ts-node\node_modules\tsconfig\src\tsconfig.ts:140:16)
at readConfig (C:\npm\node_modules\ts-node\src\index.ts:425:18)
at Object.register (C:\npm\node_modules\ts-node\src\index.ts:189:18)
at Object.<anonymous> (C:\npm\node_modules\ts-node\src\_bin.ts:140:17)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
PS C:\Users\aval\tsdev\nla\tsnodetest> ts-node -n .\index.ts
SyntaxError: Unexpected token � in JSON at position 0
at JSON.parse (<anonymous>)
at parse (C:\npm\node_modules\ts-node\node_modules\tsconfig\src\tsconfig.ts:195:15)
at readFileSync (C:\npm\node_modules\ts-node\node_modules\tsconfig\src\tsconfig.ts:181:10)
at Object.loadSync (C:\npm\node_modules\ts-node\node_modules\tsconfig\src\tsconfig.ts:151:18)
at readConfig (C:\npm\node_modules\ts-node\src\index.ts:425:18)
at Object.register (C:\npm\node_modules\ts-node\src\index.ts:189:18)
at Object.<anonymous> (C:\npm\node_modules\ts-node\src\_bin.ts:140:17)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)Reacted by Jay Jones, Alex and darkyelox
Metadata
Metadata
Assignees
Labels
No labels
Activity
blakeembrey commentedon Nov 16, 2017
Can you try with
--no-project? It looks like the README is incorrect, since it relies on an underlying library to correctly parse the CLI arguments and--project falsewould just be interpreted as a string.blakeembrey commentedon Nov 16, 2017
Closing with an update to docs: e7591c7.
NaridaL commentedon Nov 16, 2017
@blakeembrey
What about
https://github.com/TypeStrong/ts-node#loading-tsconfigjson
Also, what is the correct setting when using environment variables?
blakeembrey commentedon Nov 16, 2017
If you want to submit a PR, go for it. But
-nisn’t anything, and thenoprefix is for multiple parts. It’sfalsefor the environment variable.blakeembrey commentedon Nov 16, 2017
Oh, I see now, I have another place to update. Feel free to still submit a PR, otherwise I’ll get to it as I can.
NaridaL commentedon Nov 30, 2017
Aren't environment variables also limited to strings? Seems like that would cause the same issue...
blakeembrey commentedon Dec 1, 2017
The string is parsed as a boolean, so no.
blakeembrey commentedon Dec 1, 2017
But not that one I guess, so yes. Open to PRs.
blakeembrey commentedon Dec 7, 2017
This should add
SKIP_xxxand--skip-xxxto config flags.xiaoqf10 commentedon Dec 15, 2017
--no-project useless, sad. Still can not ignore tsconfig.json
Completely ignore tsconfig.json if project === false.
Completely ignore tsconfig.json if project === false.
NaridaL commentedon Jan 22, 2018
@blakeembrey I authored a PR to fix this.
blakeembrey commentedon Feb 19, 2018
Should be possible again now with #536. Thanks for your patience.
NikoAri commentedon Mar 11, 2020
Solution:
ts-node --skip-project MyScript.ts