question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Instructions for overriding tsconfig.json don't seem to work

See original GitHub issue

Type 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.

  1. Create a fresh sample project:
mkdir ngpackagr
cd ngpackagr
npm init -y
npm i -D typescript ng-packagr
  1. Add public_api.ts at root with contents export const FOO = 'bar';
  2. Edit package.json to add ng-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"
    }
  }
}
  1. confirm that the project builds successfully by running npm build

  2. 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
  }
}
  1. point ngpackagr to this config in the build script: "build": "ng-packagr -p package.json --config tsconfig.lib.json"

  2. 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:open
  • Created 2 years ago
  • Reactions:1
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
benelliottcommented, Feb 1, 2022

Hi @shuZro, are you sure you pointed ng-packagr to your custom tsconfig? e.g.

"build": "ng-packagr --config tsconfig.lib.json"
0reactions
shuZrocommented, Feb 1, 2022

@benelliott Yup that was the problem. Resolved thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to configure react-script so that it doesn't override tsconfig ...
I was able to do this by using advice from this issue. Put the configuration options react scripts likes to remove in a...
Read more >
TSConfig Reference - Docs on every TSConfig option
The configuration from the base file are loaded first, then overridden by those in the inheriting config file. All relative paths found in...
Read more >
TypeScript - Cypress Documentation
We recommend creating a tsconfig.json inside your cypress folder with the ... your IDE's TypeScript server if the setup above does not appear...
Read more >
Configuration Files - ESLint - Pluggable JavaScript Linter
JSON - use .eslintrc.json to define the configuration structure. ... env: browser: true rules: # Override default settings eqeqeq: warn strict: off.
Read more >
Options - TypeDoc
Values set with this option will override options read from tsconfig.json . ... Removes symbols from the generated documentation which do not have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found