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.

@angular/compiler-cli >= 4.2.0 (ngc) not generating metadata.json file

See original GitHub issue

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request

Current behavior

We use the Angular Compiler CLI (ngc) in combination with Rollup to generate the correct bundles for our (internal) Angular library, following the Angular Package Format documentation. And @angular/compiler-cli works as expected when used in version 4.1.3, meaning that compilation works, sourcemaps are here, type definitions are getting generated correctly, and the metadata.json file gets generated.

Any newer version of @angular/compiler-cli, however, does not generate the metadata.json file (while everything else seems to work properly).

Expected behavior

The @angular/compiler-cli should generate the metadata.json file on all versions / newer versions than 4.1.3.

Minimal reproduction of the problem with instructions

Trying to run ngc -p tsconfig.json in an Angular library project (e.g. https://github.com/dominique-mueller/angular-notifier) with the latest version of @angular/compiler-cli results in the problem described above.

Full tsconfig.json for ES5 build:

{
  "compileOnSave": false,
  "compilerOptions": {
    "declaration": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "es2016",
      "dom"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "outDir": "./../../build/library-es5", // Result, without the metadata.json file
    "sourceMap": true,
    "stripInternal": true,
    "target": "es5"
  },
  "files": [
    "./../../build/library-inline/index.ts" // Library source (after inlining HTML templates)
  ],
  "angularCompilerOptions": {
    "flatModuleId": "@something/my-lib",
    "flatModuleOutFile": "my-lib.js",
    "genDir": "./../../build/library-es5-gen-dir",
    "skipTemplateCodegen": true,
    "strictMetadataEmit": true
  }
}

What is the motivation / use case for changing the behavior?

This issue prevents us from from publishing a library using the latest and greatest version of Angular. In addition, because in version 4.1.3 all Angular dependencies must exist in the same version (otherwise the build fails), this prevents us from using newer Angular features (such as the new HTTP client, amongst others).

Environment

Angular version:
- Tested with 4.1.3 -- working as expected
- Tested with 4.2.0, 4.3.0 and the latest (4.3.2) -- broken
 
For Tooling issues:
- Node version: 7.10.0
- Platform:  Windows 7 & Windows 10

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:7

github_iconTop GitHub Comments

2reactions
dominique-muellercommented, Aug 25, 2017

After analyzing https://github.com/dherges/ng-packagr, it seems that using @angular/tsc-wrapped works as expected. So probably an issue within @angular/compiler-cli wrapping around it?

1reaction
michaelbromleycommented, Oct 23, 2017

I’ve been looking into this issue, and isolated the issue to be when the tsconfig.json file is not in the project root.

I have put together a minimal reproduction here: https://github.com/michaelbromley/angular-issue-18478

Read more comments on GitHub >

github_iconTop Results From Across the Web

ng packager - .metadata.json file not generated in Angular 10
I have upgraded my angular project version 8 to 10; When i execute ng serve , ng build, ng test all executes as...
Read more >
metadata.json files are generated automatically by the ngc ...
metadata.json files are generated automatically by the ngc command. That's step 6 in the article.” is published by Isaac Mann.
Read more >
ng-packagr/CHANGELOG.md
core.testing`. Publishing your npm packages built with this version of ng-packagr causes a new UMD module ID to be generated. Users of your...
Read more >
Generate NFT Metadata (JSON) using Python - Part IV
How to Make NFTs. Generate NFT Metadata ( JSON ) using Python - Much Exclusive Doge Yacht Club Collection - Part IV. 2.1K...
Read more >
"No metadata.json file" message appears every time a new ...
No metadata.json file located in "<filename>.library". If your library is stored in a cloud location, please ensure it has fully downloaded ...
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