Skip to content
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

Problem when using a custom configFile name #31

Closed
andrewhathaway opened this issue Mar 29, 2018 · 5 comments
Closed

Problem when using a custom configFile name #31

andrewhathaway opened this issue Mar 29, 2018 · 5 comments

Comments

@andrewhathaway
Copy link

Using tsconfig-paths-webpack-plugin, when setting the configFile option, it seems to go missing and doesn't work. I'm submitting the issue here, as after having a look, there's something strange going on internally to this package.

When passing the configFile option, the cwd variable gets set to the configFile's value that I passed through. At the line in the link, it's the options value: https://github.com/dividab/tsconfig-paths/blob/master/src/tsconfig-loader.ts#L39

However, after running the resolveConfigPath it's completely lost and becomes the standard absolute path for tsconfig.json, not tsconfig.production.json in my case.

I can also confirm that the TS_NODE_PROJECT env var is undefined, and won't run the codepath for if (filename) ....

Essentially it seems that even though the configFile option is passed through to this package, it doesn't actually care for it and throws it out later on.

@jonaskello
Copy link
Member

@Jontem Do you have an idea of what could be the issue?

@Jontem
Copy link
Collaborator

Jontem commented Mar 30, 2018

Can you do a minimal repro ?

@amodm
Copy link
Contributor

amodm commented Mar 31, 2018

tsconfig-paths-webpack-plugin accepts a parameter called configFile, which is supposed to be the path to any custom tsconfig.json file.

As you can see here, this parameter is passed to TsConfigPaths.loadConfig, even though the definition of loadConfig takes in only a cwd parameter

Further down the call stack, in tsconfig-loader.ts, this leads to the cwd parameter being the path to tsconfig, while filename being undefined, which leads to a directory walk searching for tsconfig.json, which in turn leads to this issue.

@jonaskello
Copy link
Member

@andrewhathaway I released tsconfig-paths-webpack-plugin 3.0.3 which will hopefully fix this.

@andrewhathaway
Copy link
Author

Ahh great stuff, thanks all involved! I was just about to prepare a minimal repro!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants