AOT compiler - Unexpected value 'Ng2DeviceDetector in ng2-device-detector/dist/index.d.ts
See original GitHub issueI’m getting
Unexpected value 'Ng2DeviceDetector in [...]/node_modules/ng2-device-detector/dist/index.d.ts' imported by the module 'AppModule in [...]/app/app.module.ts'. Please add a @NgModule annotation.
while compiling with aot compiler using:
./node_modules/.bin/ngc -p tsconfig-aot.json
everything works just fine with regular ts compiler. It this a bug or am I missing something?
my component:
import {Component} from "@angular/core";
import {Device} from "ng2-device-detector";
@Component({
selector: "device-info",
template: `
<div id="deviceInfo">
</div>
`
})
export class DeviceInfoComponent{
constructor(private device: Device) {
this.test();
}
test() {
console.log(this.device.browser);
console.log(this.device.browser_version);
console.log(this.device.device);
console.log(this.device.isDesktop());
console.log(this.device.isMobile());
console.log(this.device.isDesktop());
}
}
my app.module.ts
[...]
import {Device, Ng2DeviceDetector} from "ng2-device-detector";
@NgModule({
imports: [
[...]
Ng2DeviceDetector
],
declarations: [
[...]
DeviceInfoComponent,
],
providers: [
[...]
Device,
],
bootstrap: [
CheckoutComponent
]
})
export class AppModule {
constructor(ngCartRedux: NgRedux<ICartState>) {
ngCartRedux.provideStore(cartStore)
}
}
bootstrap: [
CheckoutComponent
]
})
export class AppModule {
constructor(ngCartRedux: NgRedux<ICartState>) {
ngCartRedux.provideStore(cartStore)
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Angular2 AoT Compiler Errors · Issue #11262 - GitHub
When I try to compile my project with ngc, it throws the below error: Error: Error encountered resolving symbol values statically.
Read more >Error: Unexpected value 'undefined' imported by the module
ts file in the root of my app that was exporting my app.component.ts . So I thought I could do the following: import...
Read more >Ahead-of-time (AOT) compilation - Angular
This allows the compiler to generate a reference to θ0 in the factory without having to know what the value of θ0 contains....
Read more >Angular and AOT - CODE Magazine
You can compile the app in the browser at runtime. This means that when the application loads, the JIT, or just-in-time compiler, does...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@sushruth The forked version does solve the issue for me
Pull request 7 seems to have resolved this issue