-
Notifications
You must be signed in to change notification settings - Fork 105
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
tsconfig-paths crashes when compilerOptions
is not present
#17
Comments
You need to set the From the typescript documentation
It also says
And that is why Also if you run error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option. |
I have set
I think some part of the library code parses the derived A totally blind guess: some check somewhere needs to look like this: |
I think this is the issue: TypeStrong/tsconfig#21 |
Sorry for the quick assumption. I'll have a look how we could solve this. |
Yes, we are using the tsconfig package to read the tsconfig.json file. The tsconfig.json file is not 100% json. For example it allows for comments which the json standard does not. I think submitting a PR for the issue mentioned above would be the best solution. |
Please give the latest version a try! |
Still has the same issue: {
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"sourceMap": true,
"lib": ["esnext"],
"outDir": "build",
"rootDir": "src",
"baseUrl": "",
"paths": {
"src": ["./src"]
},
"importHelpers": true,
"noEmitOnError": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
} Command: |
Your baseUrl is empty in the example above? Try setting it to |
TS, it works now
…On Dec 12, 2017 00:29, "Jonathan Mourtada" ***@***.***> wrote:
Your'e baseUrl is empty in the example above? Try setting it to ./
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#17 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AI30NRPWIaZQNCb6yRkMAtDqZDRmAzW7ks5s_WZ5gaJpZM4QRskC>
.
|
If |
Yes it looks like it works. But can't find any documentation that it is supposed to work this way. But should be an easy fix |
To reproduce:
tsconfig.json:
Now I run:
"test": "mocha --no-timeouts --compilers ts:ts-node/register -r tsconfig-paths/register 'tests/index.ts'"
And get:
If I add
compilerOptions
totsconfig.json
it works. This doesn't crash:Then I get a warning:
Missing baseUrl in compilerOptions. tsconfig-paths will be skipped
I'm not very familiar with this tool, but it's obvious that it tries to read from
compilerOptions
which in this case isundefined
. Hope it makes sense.EDIT: BTW, there is a
baseUrl
defined in the top-leveltsconfig.json
which the local one extends. Is that a bug, too?The text was updated successfully, but these errors were encountered: