Description
Recently typescript has added the feature of project references:
https://www.typescriptlang.org/docs/handbook/project-references.html
In the projects created with create-react-app (with --typescript switch), we are not able to use this feature of typescript because babel complains that we cannot refer files for compiling which are outside the 'src' folder.
I know that there are other workarounds such as
- publishing the other projects as modules to the npm repository and then we can install them in the create-react-app
- we can play around with 'npm link', but this approach is not clean. We have to simulate the project references, instead of using the actual references feature of typescript with this approach.
- otherwise, we can eject create-react-app, and then customize the options.
- last option is to do away with create-react-app and build the tool-chain from scratch, which I tried and made it to work with ts-loader instead of babel. In this approach, I had to set the 'projectReferences=true' option for the ts-loader inside webpack.config.js. This worked smoothly. But then I'm loosing on create-react-app, which I don't want.
But all these ways are not clean and involve the trade-off between something or the other.
Having the C# and Java background, I'm pretty much used to the concept of project references. Many will suggest to not go this route, but I do need it. If it was not useful enough, typescript wouldn't have come up with it in the first place.
Also, I'm new to the web development world (just a month old), so pardon me for my lack of knowledge and if I'm asking for something very trivial and already exists.
Thanks
-Ashish