Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Build prod is failing in angular 8 at runtime when using aot and buildOptimizer together #1107

Closed
jeandat opened this issue Jul 28, 2019 · 4 comments

Comments

@jeandat
Copy link

jeandat commented Jul 28, 2019

Bug Report

What is the expected behavior?

Production build should work normally like in dev mode.

What is the current behavior?

Runtime error:

ERROR Error: Uncaught (in promise): NullInjectorError: StaticInjectorError(AppModule)[DefaultFlexAlignDirective -> StyleUtils]: 
  StaticInjectorError(Platform: core)[DefaultFlexAlignDirective -> StyleUtils]: 
    NullInjectorError: No provider for StyleUtils!
NullInjectorError: StaticInjectorError(AppModule)[DefaultFlexAlignDirective -> StyleUtils]: 
  StaticInjectorError(Platform: core)[DefaultFlexAlignDirective -> StyleUtils]: 
    NullInjectorError: No provider for StyleUtils!
    at NullInjector.get (vendor-es2015.c5603c4025760f603c32.js:34736)
    at resolveToken (vendor-es2015.c5603c4025760f603c32.js:36499)
    at tryResolveToken (vendor-es2015.c5603c4025760f603c32.js:36425)
    at StaticInjector.get (vendor-es2015.c5603c4025760f603c32.js:36288)
    at resolveToken (vendor-es2015.c5603c4025760f603c32.js:36499)
    at tryResolveToken (vendor-es2015.c5603c4025760f603c32.js:36425)
    at StaticInjector.get (vendor-es2015.c5603c4025760f603c32.js:36288)
    at resolveNgModuleDep (vendor-es2015.c5603c4025760f603c32.js:60840)
    at NgModuleRef_.get (vendor-es2015.c5603c4025760f603c32.js:61926)
    at resolveDep (vendor-es2015.c5603c4025760f603c32.js:62453)
    at resolvePromise (polyfills-es2015.e308c8d63d076a2403a3.js:1085)
    at resolvePromise (polyfills-es2015.e308c8d63d076a2403a3.js:1042)
    at polyfills-es2015.e308c8d63d076a2403a3.js:1146
    at ZoneDelegate.invokeTask (polyfills-es2015.e308c8d63d076a2403a3.js:680)
    at Object.onInvokeTask (vendor-es2015.c5603c4025760f603c32.js:68615)
    at ZoneDelegate.invokeTask (polyfills-es2015.e308c8d63d076a2403a3.js:679)
    at Zone.runTask (polyfills-es2015.e308c8d63d076a2403a3.js:455)
    at drainMicroTaskQueue (polyfills-es2015.e308c8d63d076a2403a3.js:848)
    at ZoneTask.invokeTask [as invoke] (polyfills-es2015.e308c8d63d076a2403a3.js:758)
    at invokeTask (polyfills-es2015.e308c8d63d076a2403a3.js:1889)

What are the steps to reproduce?

Everything is explained here: angular/angular-cli#15145

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular CLI: 8.2.0-next.1
Node: 12.4.0
OS:  darwin x64
Angular: 8.2.0-next.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.802.0-next.1
@angular-devkit/build-angular     0.802.0-next.1
@angular-devkit/build-optimizer   0.802.0-next.1
@angular-devkit/build-webpack     0.802.0-next.1
@angular-devkit/core              8.2.0-next.1
@angular-devkit/schematics        8.2.0-next.1
@angular/cdk                      8.1.1
@angular/cli                      8.2.0-next.1
@angular/fire                     5.2.1
@angular/flex-layout              8.0.0-beta.26
@angular/material                 8.1.1
@angular/pwa                      0.801.2
@ngtools/webpack                  8.2.0-next.1
@schematics/angular               8.1.2
@schematics/update                0.802.0-next.1
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.35.3

Is there anything else we should know?

@jeandat
Copy link
Author

jeandat commented Jul 28, 2019

Not sure if this is an angular core, flex-layout or cli bug.

@CaerusKaru
Copy link
Member

Definitely CLI

@xmlking
Copy link

xmlking commented Jul 29, 2019

import { BaseDirective2, MediaChange, MediaMarshaller, StyleBuilder, StyleUtils } from '@angular/flex-layout';
I am also getting same issue. looking forward to test with updated flex-layout with latest Angular

core.js.pre-build-optimizer.js:4799 ERROR Error: NullInjectorError: No provider for StyleUtils!
    at NullInjector.get (core.js.pre-build-optimizer.js:779)
    at resolveToken (core.js.pre-build-optimizer.js:14644)
    at tryResolveToken (core.js.pre-build-optimizer.js:14570)
    at StaticInjector.get (core.js.pre-build-optimizer.js:14433)
    at resolveToken (core.js.pre-build-optimizer.js:14644)
    at tryResolveToken (core.js.pre-build-optimizer.js:14570)
    at StaticInjector.get (core.js.pre-build-optimizer.js:14433)
    at resolveNgModuleDep (core.js.pre-build-optimizer.js:24920)
    at NgModuleRef_.get (core.js.pre-build-optimizer.js:25979)
    at resolveDep (core.js.pre-build-optimizer.js:26509)

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants