Fork-ts-checker-webpack-plugin: Equivalent for ts-loader's context

Created on 4 Jun 2019  路  14Comments  路  Source: TypeStrong/fork-ts-checker-webpack-plugin

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!!!

enhancement released released on @alpha released on @beta

Most helpful comment

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

The release is available on:

Your semantic-release bot :package::rocket:

All 14 comments

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?

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.

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

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

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).

@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.

image

@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 :)

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 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

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

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

The release is available on:

Your semantic-release bot :package::rocket:

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

The release is available on:

Your semantic-release bot :package::rocket:

:tada: This issue has been resolved in version 5.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Was this page helpful?
0 / 5 - 0 ratings