Skip to content

UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property warnings of 'undefined' or 'null'. #15263

@JonWallsten

Description

@JonWallsten

🐞 Bug report

Command (mark with an x)

- [x ] build

Is this a regression?

Yes, the previous version in which this bug was not present was: 8.0.0

Description

Whenever there's an error in a scss-file connected to a component, childCompilation becomes undefined and hence can't be destructed. err is provided. So I guess you just need handle the empty childCompilation case.

#angular-cli/packages/ngtools/webpack/src/resource_loader.ts:109
const { warnings, errors } = childCompilation;

🔬 Minimal Reproduction

https://github.com/JonWallsten/angular-bug
Step 1: npm i
Step 2: npm run build
Step 3: ...
Step 4: Profit!

🔥 Exception or Error

UnhandledPromiseRejectionWarning: TypeError: Cannot destructure property `warnings` of 'undefined' or 'null'.
    at childCompiler.compile (C:\Users\jway52\repo\angular-devkit-bug\node_modules\@ngtools\webpack\src\resource_loader.js:81:46)
    at compilation.seal.err (C:\Users\jway52\repo\angular-devkit-bug\node_modules\webpack\lib\Compiler.js:666:23)
    at hooks.additionalAssets.callAsync.err (C:\Users\jway52\repo\angular-devkit-bug\node_modules\webpack\lib\Compilation.js:1369:13)
    at _err0 (eval at create (C:\Users\jway52\repo\angular-devkit-bug\node_modules\tapable\lib\HookCodeFactory.js:33:10), :9:1)
    at _evaluate.then.catch.err (C:\Users\jway52\repo\angular-devkit-bug\node_modules\@ngtools\webpack\src\resource_loader.js:70:39)
    at process._tickCallback (internal/process/next_tick.js:68:7)

🌍 Your Environment


Angular CLI: 8.2.0
Node: 10.16.0
OS: win32 x64
Angular: 8.2.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.802.0
@angular-devkit/build-optimizer   0.802.0
@angular-devkit/core              8.2.0
@angular-devkit/schematics        8.2.0
@angular/cdk                      8.1.2
@angular/http                     8.0.0-beta.10
@angular/material                 8.1.2
@ngtools/webpack                  8.2.0
@schematics/angular               8.2.0
@schematics/update                0.802.0
rxjs                              6.5.2
typescript                        3.5.3
webpack                           4.39.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions