I'm using this excellent webpack-loader for a monorepo, and ran into a bit of a configuration snafu. Some of the monorepo packages are ejected Create React App projects, and I migrated to this from other ts loaders, so I was passing in the configFileName
as defined by the React paths (which are just normalized absolute paths).
For awhile this was fine, as I was only importing one linked project into another, a single level deep (A imports B). Recently, however, I added a nested linked dependency (A imports B imports C), and I started getting errors (can't find C from B).
Long story short, after a bunch of debugging, I found that this issue was related to tsconfig lookups. When passing an absolute path as configFileName
, all lookups resolve to that config file and therefore nested path resolution breaks. Maybe this should have been obvious, and knowing how the lookup algorithm works, it certainly is, but it tripped me up for quite awhile nonetheless. The obvious solution in my case was to simply remove configFileName
from the webpack configurations, and the lookup algorithm did its job perfectly.
I suppose this is probably an edge case. For example, I assume everything would also work if configFileName
were simply the file name itself, and all config file names had the same name (not super unreasonable). However, I believe this could be an issue if the config file names were different across linked projects. One example that comes to mind is Angular, where it's common to have a tsconfig.aot.json
. In this case, if a dependency did not have this file name, it would presumably fail. To make this work, we might need to have configFileName
accept a function.
Anyways, at the very least I wanted to log this issue in case someone else runs into it. Feel free to close this, and thanks for the great loader.