'rootDir' is expected to contain all source files
See original GitHub issueBug Report or Feature Request (mark with an x
)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Command (mark with an x
)
- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Versions
node --version: 8.9.0
npm -v: 5.6.0
ng -v:
Angular CLI: 6.1.3
Node: 8.9.4
OS: linux x64
Angular: 6.1.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-ng-packagr 0.7.3
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.7.3
@angular/cli 6.1.3
@ngtools/json-schema 1.1.0
@ngtools/webpack 6.0.8
@schematics/angular 0.7.3
@schematics/update 0.7.3
ng-packagr 3.0.6
rxjs 6.2.2
typescript 2.9.2
webpack 4.8.3
Repro steps
- Clone https://github.com/samherrmann/angular-sandbox
- Checkout
rootDir-expect-all-source-files-error
branch - Run
npm install
- Run
npm run build
The log given by the failure
error TS6059: File '/code/projects/bar/src/lib/types.ts' is not under 'rootDir' '/code/projects/foo/src'. 'rootDir' is expected to contain all source files.
Error: error TS6059: File '/code/projects/bar/src/lib/types.ts' is not under 'rootDir' '/code/projects/foo/src'. 'rootDir' is expected to contain all source files.
at Object.<anonymous> (/code/node_modules/ng-packagr/lib/ngc/compile-source-files.js:53:68)
at Generator.next (<anonymous>)
at /code/node_modules/ng-packagr/lib/ngc/compile-source-files.js:7:71
at new Promise (<anonymous>)
at __awaiter (/code/node_modules/ng-packagr/lib/ngc/compile-source-files.js:3:12)
at Object.compileSourceFiles (/code/node_modules/ng-packagr/lib/ngc/compile-source-files.js:19:12)
at Object.<anonymous> (/code/node_modules/ng-packagr/lib/ng-v5/entry-point/ts/compile-ngc.transform.js:26:32)
at Generator.next (<anonymous>)
at /code/node_modules/ng-packagr/lib/ng-v5/entry-point/ts/compile-ngc.transform.js:7:71
at new Promise (<anonymous>)
Desired functionality
I would expect the build to be successful. I am not sure at this point if this is a tsconfig
issue, or a tsc
issue, or some other issue.
Mention any other details that might be useful
I also asked this on StackOverflow
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
error TS6059: File is not under 'rootDir' .. 'rootDir' is expected ...
One fix is to just remove "rootDir": "src" from compiler options, so it gets set automatically. Caution: rootDir will then consider both ...
Read more >File is not under 'rootDir' 'packages'. 'rootDir' is expected to ...
File is not under 'rootDir' 'packages'. 'rootDir' is expected to contain all source files in npm preset #10773.
Read more >File is not under 'rootDir' error in TypeScript | bobbyhadz
The "File is not under 'rootDir'" error occurs when we try to import something from a file that is not located under the...
Read more >TSConfig Option: rootDir - TypeScript
rootDir. Default: The longest common path of all non-declaration input files. ... the default is instead the directory containing the tsconfig.json file.
Read more >Diagnostics option | ts-jest - GitHub Pages
6059 : 'rootDir' is expected to contain all source files. 18002 : The 'files' list in config file is empty. (it is strongly...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I wanted to check this really considered fixed? I have two publishable libraries (using nrwl) and facing the same problem my version of devkit/core : “@angular-devkit/core”: “^0.8.5”,
Note that I was playing with Angular elements like a monkey (and angular libs as a consequence) and got this error by importing stuff from the main app into the lib.
hint: don’t do this, element dependencies should come through the component’s inputs.