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.

AoT compilation fails

See original GitHub issue

Code that works fine with JIT fails with AOT. The only error that I get with AOT is

Error: Unexpected value ‘nvD3’ imported by the module ‘StatisticsModule’

The code

import {NgModule} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import {nvD3} from 'ng2-nvd3'
import {SharedModule} from '../../shared/sharedModule';
import {StatsChartComponent} from './charts';

const statsRoutes: Routes = [
//...
];

@NgModule({
    imports: [ 
        nvD3,
        SharedModule,
        RouterModule.forChild(statsRoutes)
    ],
    declarations: [
        StatsChartComponent
    ]
})
export class StatisticsModule {}

based on problems other packages are having, my guess is that a metadata.json file is needed, though I don’t know what goes in it.

“If we want the library to be AoT compatible, it should be pre compiled and the metadata files published on npm”

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
daominhsangvncommented, Feb 17, 2017

@martinmanzo I have enabled Issues

0reactions
martinmanzocommented, Feb 16, 2017

@daominhsangvn Could you enable Issues in your repo?

How do I manage a click event on a chart?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Aot compilation fail when publishing for iOS #8286 - GitHub
Description I'm trying to publish a maui app on a windows pc by pairing it with a Mac, with the command dotnet publish...
Read more >
Angular AOT compilation failed - typescript - Stack Overflow
The compiler will fail if you have Typescript errors (even if you forgot to type a variable, for example public myVar; will throw...
Read more >
Diagnosing a JIT or AOT problem - IBM
By determining whether the JIT or AOT compiler is faulty and, if so, where it is faulty, you can provide valuable help to...
Read more >
Ahead-of-time (AOT) compilation - Angular
The Angular ahead-of-time (AOT) compiler converts your Angular HTML and TypeScript code into efficient JavaScript code during the build phase before the ...
Read more >
Angular: Writing AoT-friendly applications | by David - Medium
This causes AoT compilation to fail and has two possible solutions. First, change the method implementation in the class to accept a paramter...
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