ng-package.json is ignored if in same directory as package.json
See original GitHub issueType of Issue
[x] Bug Report
[ ] Feature Request
Description
It is pretty common to create an ng-package.json file and put it alongside package.json, and use that as the input to ng-packagr. It is expected that package.json would be ignored, since it is just for development. With version 2.3 and 2.4 this scenario is broken. The entire contents of ng-pacakge.json will be ignore and the contents of package.json used instead.
How To Reproduce
- Create an Angular app with a normal package.json
- Create a file called ng-package.json alongside package.json, e.g.
{
"$schema": "./node_modules/ng-packagr/package.schema.json",
"name": "myapp",
"version": "0.0.1",
"ngPackage": {
"lib": {
"entryFile": "public_api.ts"
}
}
}
- Create a public_api.ts file, again in that same directory
- Run
ng-packagr -p ng-package.json
I see this error:
BUILD ERROR
error TS6053: File '/Users/pbeber/myapp/src/public_api.ts' not found.
This error is happening because it is ignoring the contents of ng-package.json and using package.json instead. Package.json has no ngPackage node so it is using the default value for ngPackage.lib.entryFile which is “src/public_api.ts”.
I made a repo that reproduces the problem:
git clone https://github.com/philipbeber/packagr-example.git
cd packagr-example
npm install
npm run packagr
Expected Behaviour
I expect it to work and to use the config parameters in ng-pacakge.json, since that’s the file I’m telling it to use.
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: 2.4.2
@angular/compiler: 5.2.10
@angular/compiler-cli: 5.2.9
rollup: 0.55.5
tsickle: 0.27.2
typescript: 2.5.3
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top GitHub Comments
Same thing then. The
ngPackage
is only needed in package.json, not ng-package.json.This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
This action has been performed automatically by a bot.