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.

@angular-builders/custom-webpack with @angular-devkit/build-angular version 0.1000.0-next.0 throws error - ERROR in Cannot read property 'flags' of undefined

See original GitHub issue

Describe the Bug

This issue is based on the issue https://github.com/angular/angular-cli/issues/17499

When using @angular-builders/custom-webpack with @angular-devkit/build-angular version 0.1000.0-next.0 throws error - ERROR in Cannot read property 'flags' of undefined

Minimal Reproduction

More details on the issue can be found at https://github.com/angular/angular-cli/issues/17499

The issue and possible solution is further explained in comment https://github.com/angular/angular-cli/issues/17499#issuecomment-617303792

Expected Behavior

It should compile successfully without throwing error.

Environment


Libs
- @angular/core version: 10.0.0-next.2
- @angular-devkit/build-angular version: 0.901.0
- @angular-builders/custom-webpack: 9.1.0-beta.0

Angular CLI: 10.0.0-next.0
Node: 13.13.0
OS: win32 x64

Angular: 10.0.0-next.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router, service-worker
Ivy Workspace: Yes

Package                                    Version
--------------------------------------------------------------------
@angular-devkit/architect                  0.900.7
@angular-devkit/build-angular              0.901.0
@angular-devkit/build-optimizer            0.900.7
@angular-devkit/build-webpack              0.900.7
@angular-devkit/core                       10.0.0-next.0
@angular-devkit/schematics                 10.0.0-next.0
@angular/cdk                               9.2.1
@angular/cli                               10.0.0-next.0
@angular/fire                              6.0.0-rc.1
@angular/google-maps                       9.2.1
@angular/material                          9.2.1
@angular/pwa                               0.1000.0-next.0
@ngtools/webpack                           9.0.7
@nguniversal/module-map-ngfactory-loader   9.0.0-next.9
@schematics/angular                        10.0.0-next.0
@schematics/update                         0.1000.0-next.0
rxjs                                       6.5.5
typescript                                 3.8.3
webpack                                    4.41.2

Additional Context

Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
just-jebcommented, Jul 6, 2020

angular-builders 9 do not support Angular 10. Use 10.0.0-beta.0.

5reactions
seangwrightcommented, Apr 23, 2020

I’m currently seeing this with consistent v9.1.x Angular dependencies.

package.json

 "dependencies": {
    "@angular/animations": "9.1.3",
    "@angular/cdk": "9.2.1",
    "@angular/common": "9.1.3",
    "@angular/compiler": "9.1.3",
    "@angular/core": "9.1.3",
    "@angular/forms": "9.1.3",
    "@angular/platform-browser": "9.1.3",
    "@angular/platform-browser-dynamic": "9.1.3",
    "@angular/router": "9.1.3",
    // ...
  },
  "devDependencies": {
    "@angular-builders/custom-webpack": "9.1.0",
    "@angular-devkit/build-angular": "0.901.3",
    "@angular/cli": "9.1.3",
    "@angular/compiler-cli": "9.1.3",
    "@angular/language-service": "9.1.3",
    "ts-node": "8.9.0",
    "tslint": "6.1.1",
    "typescript": "3.8.3",
    // ...
}

angular.json

"architect": {
  "build": {
    "builder": "@angular-builders/custom-webpack:browser",
    "options": {
      "customWebpackConfig": {
        "path": "./custom-webpack.config.js",
        "mergeStrategies": {
          "optimization.minimize": "replace"
        }
      },

custom-webpack.config.js

const TerserPlugin = require('terser-webpack-plugin');

module.exports = {
    optimization: {
        minimizer: [
            new TerserPlugin({
                parallel: 4,
                sourceMap: true,
            }),
        ],
    },
};

Running ng build "-c" "production" results in ERROR in Cannot read property 'flags' of undefined.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@angular-devkit/build-angular version 0.1000.0-next.0 throws ...
@angular-devkit/build-angular version 0.1000.0-next.0 throws error - ERROR in Cannot read property 'flags' of undefined #17499.
Read more >
ERROR in TypeError: Cannot read property 'flags' of undefined
I have a problem when I try to run ng serve on a recently created Angular project. The version ...
Read more >
Cannot read property 'flags' of undefined : WEB-18383
typescript compiler throw error: Error:Error has occurred in the compile process TypeError: Cannot read property 'flags' of undefined.
Read more >
Fresh install of Angular, getting error when creating project
As soon as I run ng serve -o I get the following error: "ERROR in TypeError: Cannot read property 'flags' of undefined".
Read more >
@angular-devkit/build-angular: Versions | Openbase
Workspace projects with missing root is now an error. @ngtools/webpack. TypeScript versions older than 4.8.2 are no longer supported. @schematics/angular ...
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