-
Notifications
You must be signed in to change notification settings - Fork 33
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
Includes baseUrl in parsed path when it shouldn't #1
Comments
Possible solution would be to allow an argument to the CLI --jsPath
|
HI there! I will reproduce your setup and look for possible solutions! brb :) thanks for helping me squash a potential bug! |
Unfortunately @spentak's solution doesn't work for me. I have:
and after building the project, I run:
TSPath then tries to find the dist folder under src:
It should be looking in 'D:...\projectName\dist'. EDIT: only after writing this do I notice that your solution is only a SUGGESTED solution. Doh. |
@erikjalevik the same |
I also put up a SO question here: https://stackoverflow.com/questions/50101147/how-to-configure-electron-to-use-typescripts-baseurl But still no replies. |
@erikjalevik I have a decision, but my webstorm breaks, will answer you once success |
@erikjalevik what I did: my
I made
what I have to do is change @duffman what do you think? |
@erikjalevik https://github.com/ShepelievD/tspath check it, example usage Yeah, I know that is tricky, but I need it urgent :) |
@ShepelievD 404 not found :( |
@kaanoo2904 yes, removed it, because decided to use https://github.com/ilearnio/module-alias
|
so.. it is useless because of this |
No, you are pretty useless at reading and interpreting stuff I´d say... not even tspath can help you there |
This has been resolved in 1.3.5 Regarding the suggestion of having tspath accept a param specifying the dist folder, I really don´t see when you´d use that? Being able to make it independent of the tsconfig.json would perhaps be something you could use in a headless build process, I don´t know but to single out the dist directory makes no real sense? |
@duffman I'm a little confused. I am experiencing the same issue as the OP using version 1.3.7. And if this has been resolved why is this issue still open? My compiler options contain: {
"outDir": "build",
"baseUrl": ".",
"paths": {
"@src/*": ["src/*"],
"@modules/*": ["src/modules/*"],
"@utils/*": ["src/utils/*"]
},
"include": ["src/**/*"]
} Paths in the build directory are all one level off. They contain "src" when they shouldn't. What would be a fix for this? |
For now I've worked around it using "_moduleAliases": {
"@src": "build",
"@modules": "build/modules",
"@utils": "build/utils"
}, My deployed code now runs (using google cloud functions). I'd still prefer to rewrite the paths with tspath though. |
The fact that this is still unresolved is completely bananas. 🍌 |
The fact that your structure becomes dist/src is because the source
structure looks like that, that’s how the typescript compiler will output
the result, and really how else do you expect it to work??
If you want to move around the result, create a gulpfile, shellscript or
whatever, really don’t know what you expect tspath to do? Guess that src
means source and move everything a level up, please explain or better yet
push an updated version!
mån 28 jan. 2019 kl. 12:58 skrev Nils Weldon <[email protected]>:
… The fact that this is still unresolved is completely bananas. 🍌
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAAy_9b6ifuw0153Tsn3V-EB7eLM_msuks5vHuXggaJpZM4Rg9V_>
.
|
For runtime resolution of If you prefer 'build time' rewriting with a compiler plugin, the only IntelliJ in particular is not a fan of this, and I'd randomly end up with a I hope this is of help to someone. 🙂 |
@duffman: I was hoping that |
@duffman Sorry for not being clear. With the tsconfig I use, {
"outDir": "build",
"baseUrl": ".",
"paths": {
"@src/*": ["src/*"],
"@modules/*": ["src/modules/*"],
"@utils/*": ["src/utils/*"]
},
"include": ["src/**/*"]
} A file at Alternatively I have tried this config: {
"outDir": "build",
"baseUrl": "./src",
"paths": {
"@src/*": ["./*"],
"@modules/*": ["modules/*"],
"@utils/*": ["utils/*"]
},
"include": ["src/**/*"]
} This effectively results in the same output file structure. If I then try to run tspath, I get an error because it tries to read from /build/src. So it seems to me there is an incompatibility between |
Hi guys, I have created a pull request to solve this problem. #27 |
Since this is still unchanged, I recommend migrating to https://github.com/joonhocho/tscpaths |
I Will Review the PR
ons 1 apr. 2020 kl. 18:58 skrev Joseph Krusling <[email protected]>:
… Since this is still unchanged, I recommend migrating to
https://github.com/joonhocho/tscpaths
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAADF75VAUKQ57U72AEFPTDRKNXCNANCNFSM4EMD2V7Q>
.
|
Great work on this well needed package!
I think there may be an issue with resolving paths. With the correct setup for paths I get an error.
So I have:
My tsconfig:
The line of code:
import { graphqlSchema } from 'graphql-schemas/schemas';
Trace:
Error: Cannot find module '../src/graphql-schemas/schemas'
Expected parsed path:
../graphql-schemas/schemas
The paths that the parser are putting out are using the
baseUrl
as the root (it appears), but in reality they should be in relation to the directory in which they live? Like a reverse traverse upwards until they find the file?And if i take the
src
out of the arrays, TypeScript wont' compile because it can't resolve it. Can't have one without the other :)The text was updated successfully, but these errors were encountered: