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

Equivalent for ts-loader's context #297

Closed
stavalfi opened this issue Jun 4, 2019 · 14 comments
Closed

Equivalent for ts-loader's context #297

stavalfi opened this issue Jun 4, 2019 · 14 comments

Comments

@stavalfi
Copy link

stavalfi commented Jun 4, 2019

Feature motivation

https://github.com/TypeStrong/ts-loader#context-string-defaultundefined
This is a killer feature in complex projects.

In my specific use-case, I moved all my build related files (including tsconfig.json) to a different package (something like create-react-app is doing but in much more flexible way) in my mono-repo and everything is working great. it's just that i'm fighting to use this KILLER plugin!


  • as a workaround, I could override all the relevant tsconfig.json proeprties inside this plugin's options, but I can't override include and exclude properties :(

Thanks again for you amazing work!!!

@johnnyreilly
Copy link
Member

Heya! Thanks for the complements! Maintainer of both ts-loader and fork-ts-checker-webpack-plugin here. It would be great to understand more about your use case. Could you go into some more details please?

Also, would you consider working on a PR?

@stavalfi
Copy link
Author

stavalfi commented Jun 4, 2019

hihihi!

I'm working on a super Lerna-starter that pretty much includes everything there is to include. I'm not even close to finishing but anyways, here is a taste: https://github.com/stavalfi/lerna-starter (just run yarn and you are good to go).

as part of my work, I found out that a lot of the sub packages (workspaces in yarn) has 90% of their build strategy in common. for example, packages that generate js to be used by other packages, like react/angular/... and packages that generate webapps/websites/... for each group of packages, most of the build files are the same so I moved all of them to a dedicated sub-package under "build". you can look it out your self, it's working great with all the 3rd party packages that I'm using like webpack, eslint and more.

actually, I lied... I moved all of them except a single build file: "tsconfig.json". I need that in each package from any type for 2 reasons: webstorm-typescript integration AND this plugin.

for the first reason, I can use a tsconfig.json that is in the main folder (where .git folder is). for the second reason, I need your help so I can move it from there and I will get a complete 100% free-build-files packages.

@johnnyreilly
Copy link
Member

Sorry I think I missed this reply! This sounds like a potentially interesting feature; do you want to submit a PR?

@stavalfi
Copy link
Author

I have no idea where to start lol.. let me investigate a little bit..

@u8sand
Copy link

u8sand commented Jul 21, 2019

I would also be interested in this capability--my use case is building opinionated reusable webpack build scripts--tsconfig.json is defined in the build scripts project but it will be utilized to build typescript in a separate project. When context is not set, the include paths don't check in the right location (instead it checks in the same place as tsconfig.json).

@stavalfi
Copy link
Author

@u8sand we have the same use case :) you can have a look at what I did here: https://github.com/stavalfi/flow under packages/build.

I also have a starter-project that is the non-up-to-date-copy of this project: https://github.com/stavalfi/lerna-starter

@johnnyreilly I didn't start working on it yet. so if someone else want to investigate, it would be great.

@joebnb
Copy link

joebnb commented May 19, 2020

image

@piotr-oles
Copy link
Collaborator

piotr-oles commented May 26, 2020

@stavalfi I'm just wondering - maybe you could use process.cwd() in the tsconfig.json file path? Or you could even use it for the webpack's context field? Then, you can use a path for the tsconfig.json that is relative to the webpack's context.

Also, please check out the alpha version which supports Project References - it can be useful in the monorepo :)

@shayke
Copy link

shayke commented May 27, 2020

Anyone has a workaround?
I'm also using a tsconfig.json file inside an npm package and getting:
ERROR in ERROR in undefined(undefined,undefined):

@stavalfi
Copy link
Author

@stavalfi I'm just wondering - maybe you could use process.cwd() in the tsconfig.json file path? Or you could even use it for the webpack's context field? Then, you can use a path for the tsconfig.json that is relative to the webpack's context.

Also, please check out the alpha version which supports Project References - it can be useful in the monorepo :)

Sory, it was a while ago and I stopped working with webpack. I'm not working on the same project so I don't have the time to contribute to this conversation.

Best of luck guys

@piotr-oles piotr-oles self-assigned this May 28, 2020
@piotr-oles
Copy link
Collaborator

@shayke , @joebnb , @u8sand
I will create a PR soon :)

piotr-oles added a commit that referenced this issue May 28, 2020
Add `context` option to support usage of external tsconfig.json files.

✅ Closes: #297
piotr-oles added a commit that referenced this issue May 28, 2020
Add `context` option to support usage of external tsconfig.json files.

✅ Closes: #297
piotr-oles added a commit that referenced this issue May 28, 2020
Add `context` option to support usage of external tsconfig.json files.

✅ Closes: #297
piotr-oles added a commit that referenced this issue May 28, 2020
Add `context` option to support usage of external tsconfig.json files.

✅ Closes: #297
piotr-oles added a commit that referenced this issue May 28, 2020
Add `context` option to support usage of external tsconfig.json files.

✅ Closes: #297
piotr-oles added a commit that referenced this issue May 28, 2020
Add `context` option to support usage of external tsconfig.json files.

✅ Closes: #297
piotr-oles added a commit that referenced this issue May 28, 2020
Add `context` option to support usage of external tsconfig.json files.

✅ Closes: #297
piotr-oles added a commit that referenced this issue May 28, 2020
Add `context` option to support usage of external tsconfig.json files.

✅ Closes: #297
@piotr-oles
Copy link
Collaborator

🎉 This issue has been resolved in version 5.0.0-alpha.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

@piotr-oles
Copy link
Collaborator

🎉 This issue has been resolved in version 5.0.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@piotr-oles
Copy link
Collaborator

🎉 This issue has been resolved in version 5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

No branches or pull requests

6 participants