Questions tagged [angular2-aot]

Use angular2-aot for questions related to the Angular2 ahead-of-time compiler, which allows developers to deploy pre-compiled JavaScript code and HTML5 markup to the browser rather than TypeScript and Angular templates.

References

431 questions
5
votes
3 answers

@ngtools\webpack AOT doesn't work OR freezes at 95% emitting

I've been stuck trying to get AOT working with my Webpack app. (@ngtools/webpack) Can anyone help me at all? It appears to work, however, compiler.js is still included in the bundle. Also it is still looking for all of my .html files and getting 404…
JBoothUA
  • 3,040
  • 3
  • 17
  • 46
5
votes
1 answer

window is not defined using Angular4 + AoT + Webpack2

I have an angular4 app that uses webpack and has been working great with JiT but now I'm trying to get it working with AoT and I'm having issues. Specifically I'm getting the following error: ERROR in window is not defined ERROR in…
5
votes
1 answer

Angular 4 i18n get translation for TS/JS code also

I'm using the default i18n process for my Angular 4 project, so I use ng-i18n to generate the .xlf without problem. But on my typescript code I also have some texts that need to be translated and retrieved by id for the current language. I can't…
jaumard
  • 8,202
  • 3
  • 40
  • 63
5
votes
2 answers

Does 'ng build' use AOT compilation when production is set to true in environment?

It was my understanding that during ng build AOT compilation is used by default and that only in development (ng serve) you are required to set --aot flag. But right now I have a project in front of me which makes use of classes and methods from the…
hvsp
  • 327
  • 4
  • 12
5
votes
0 answers

Angular 2 AOT - "Uncaught ReferenceError: exports is not defined error"

I having a problem running Angular 2 app compiled for AoT with Rollup using instructions from angular.io docs (link here) The compilation process goes OK as far as I can tell though I'm getting this as the only output: ⚠️ 'default' is imported…
MichaelLis
  • 81
  • 1
  • 1
  • 5
5
votes
2 answers

window is undefined when used as useValue provider with Angular 4 AoT

When Angular 4.0.2 application is compiled ahead-of-time, and the provider is defined as useValue import { OpaqueToken, Provider } from '@angular/core'; export const windowToken = new OpaqueToken('window'); export const windowProvider = { provide:…
Estus Flask
  • 206,104
  • 70
  • 425
  • 565
5
votes
1 answer

How can I get metadata for the current module in Angular 2?

I want to get the metadata for the current NgModule in order to get the list of declarations and providers in order to fill in a dynamic module I create to display components in a modal. How can that be done?
Andre Soares
  • 1,968
  • 3
  • 21
  • 24
5
votes
1 answer

Angular 2 AOT and lazy loading without using Angular CLI

I am working with a very simple Angular 2 application, and I am not using the Angular CLI (for the sake of this specific question, please do not suggest that I use the CLI). When using the JIT compiler the site runs without any issues. Eagerly…
Chris Knight
  • 1,448
  • 1
  • 15
  • 21
5
votes
1 answer

Angular 2 AOT does not works. Why "platformBrowser().bootstrapModuleFactory" pulls links with additional prefix "/src/linker/ng_module_factory"?

When I run my Angular 2 app using JIT everything works fine. But after I switch to AOT my app starts pulling links with additional prefix ("/src/linker/ng_module_factory") for example: JIT pulls:…
vladbrk
  • 93
  • 10
4
votes
1 answer

multiple angular application in single webpack config

i have project with many standelone angular application on it. Typical user case can be : admin.ts front.ts dashboard.ts Where each are angular app. To manage that, i have actually single webpack.config.js where i do all packaging stuff. The…
Yanis-git
  • 7,737
  • 3
  • 24
  • 41
4
votes
1 answer

Angular 4 Ahead-of-Time - lazyload doesn't work

I have a project with SystemJS. I use NGC and Rollup for AOT compilation. All works fine but lazyload for routing doesn't work. For example, it's my tsconfig-aot.json { "compilerOptions": { "target": "es5", "module": "es2015", …
Taras Kovalenko
  • 2,323
  • 3
  • 24
  • 49
4
votes
1 answer

(Angular / AOT) - Angularfire2 'initializeApp()' not loading the correct config properties

We are developing an Ionic hybrid app that uses Firebase as its backend. For it, we are using the npm package angularfire2. We have two databases, one for development and another one for production, so we want to swap them depending on the state of…
4
votes
0 answers

Angular 5 / AoT / Webpack / Code splitting issues

I am encountering a couple issues wrt getting AoT working in Angular 5 using Webpack. The Webpack AoT build completes without errors. 1) Code splitting due to lazily loaded modules is not happening when using @ngtools/webpack AngularCompilerPlugin.…
user3481798
  • 247
  • 2
  • 11
4
votes
1 answer

Why Angular AOT compiles even when templates are accessing private properties?

First of all I would like to say that I am completely new to Ionic and also to Angular. Forgive me for any stupid question or comment. Well, I'm doing some testing to better understand how the AOT compiler works with Angular and Ionic. I came across…
Marlon Patrick
  • 2,366
  • 1
  • 18
  • 26
4
votes
1 answer

AOT: ngtools/webpack + lazy loading does not work. Using: Angular 4, webpack 3

I've tried to use ngtools/webpack for AOT compilation. It worked fine until I tried to create lazy loaded routes. The error I get - Error: Cannot find module './components/dashboard/dashboard.module.ngfactory'.. In the dist folder I'm also missing…