-
Notifications
You must be signed in to change notification settings - Fork 12.8k
rootDir and path mapping does not work for paths outside rootDir #21967
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
Comments
|
@Andy-MS I understand. Ideally, the compiler should somehow know that it should only emit the js for the ts files that are in I'm not sure I follow what you're saying. I use First:
Second:
First case it's useful during development. It works the same for tests (with jest), rerun when there are changes in either package. Second case it's a single run task that's supposed to compile the ts files to js and a subsequent step that takes the result and generates UMD and FESM modules (using Rollup). That's why it's essential to keep the same folder structure, otherwise I'd need to make a different script for each package that knows where the compiler outputs the files and how the folder structure looks like (even though this is trivial, it's easy to forget this when you add new packages or remove them and the output tree changes). |
That wouldn't work at runtime if the compiled output of |
@Andy-MS are you sure about that? Because that's not what I'm seeing. Just |
Yes, because it sees the files in |
Ok. I've already been subscribed to that issue. So what you're also saying that currently there's no way to have the |
Quick question, could I use the programmatic API to find out how the folder structure emitted by the compiler would look like (based on the path mappings and base url)? |
Ok, I resorted to simply searching for a file that I know will be at the root of the emitted folder that I'm interested in. Not ideal, but it works. If there are no plans to support a rootDir when path mappings are outside of the root dir path, then I guess this issue can be closed. |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
TypeScript Version: 2.6.2
Search Terms: rootDir, rootDir and path mapping, path mapping, path map rootdir, etc.
Code
Clone cra-workspaces.
yarn install
at rootcd packages/package-b
yarn build
Expected behavior:
TS compiler should compile without errors.
Actual behavior:
The compiler throws:
I understand that this happens because I set
rootDir
and that the paths are outside, but I need the rootDir to generate a proper folder structure after compilation (everything that's inside ofpackages/package-b/src
should end up compiled inpackages/package-b/out-tsc/lib-es2015/
with the exact structure of the contents ofpackages/package-b/src
).Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: