Instructions for overriding tsconfig.json don't seem to work
See original GitHub issueType of Issue
[x] Bug Report
[ ] Feature Request
Description
A bug: please describe the error that you encountered
I encountered some issues when trying to upgrade my 12.x project (which overrides some tsconfig options) to 13.x. I was unable to find a working solution for overriding some tsconfig options. I could reproduce the issue on a fresh minimal reproduction.
A feature: please describe your use case and motivation
How To Reproduce
A bug: please include instructions how to reproduce. Issues without reproduction are likely to receive no feedback.
- Create a fresh sample project:
mkdir ngpackagr
cd ngpackagr
npm init -y
npm i -D typescript ng-packagr
- Add
public_api.ts
at root with contentsexport const FOO = 'bar';
- Edit
package.json
to addng-packagr
build script:
{
"name": "ngpackagr",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "ng-packagr -p package.json"
},
"author": "",
"license": "ISC",
"devDependencies": {
"ng-packagr": "^13.0.3",
"typescript": "^4.4.4"
},
"ngPackage": {
"lib": {
"entryFile": "public_api.ts"
}
}
}
-
confirm that the project builds successfully by running
npm build
-
add custom
tsconfig.lib.json
per these instructions, with contents
{
"extends": "./node_modules/ng-packagr/lib/ts/conf/tsconfig.ngc.json",
"compilerOptions": {
"types": ["node"],
"allowSyntheticDefaultImports": true
}
}
-
point ngpackagr to this config in the build script:
"build": "ng-packagr -p package.json --config tsconfig.lib.json"
-
run
npm build
and get error message:
Compiling with Angular sources in Ivy partial compilation mode.Error: ENOENT: no such file or directory, open '[my project dir]/node_modules/ng-packagr/lib/ts/conf/AUTOGENERATED'
at Object.openSync (fs.js:498:3)
at readFileSync (fs.js:394:35)
...
Can you reproduce the error in the integration tests in ng-packagr?
If possible, take a look at the integration/samples
and try to break one of these builds!
Is the error you faced in an application importing the library
Try to break the Angular CLI app in integration/consumers/ng-cli
!
Expected Behaviour
A bug: please describe what behaviour or result you expected
It should compile
A feature: do you have a first draft or an idea how to implement?
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: 13.0.3
@angular/*: N/A
typescript: 4.4.4
rxjs: N/A
node: 14.17.6
npm/yarn: 7.21.0
Windows 10
Please include all version numbers that might be relevant, e.g. third-party libraries
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:12 (4 by maintainers)
Top GitHub Comments
Hi @shuZro, are you sure you pointed
ng-packagr
to your customtsconfig
? e.g.@benelliott Yup that was the problem. Resolved thanks!