Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent cache error - from pack: TypeError: Cannot read property 'map' of undefined #1012

Open
KhoaSydney opened this issue Jul 8, 2021 · 3 comments

Comments

@KhoaSydney
Copy link

KhoaSydney commented Jul 8, 2021

Describe the Bug

Restoring failed for persistent caching

Minimal Reproduction

Angular CLI 12.1.1,
image

Angular-Builders/Custom-Webpack 12.1.1.beta

First build ran successfully. I can see the cache folders for angular-webpack and babel-webpack and cache files created.
Second build, there are lot of warning (from pack: TypeError: Cannot read property of 'map' of undefined). If I replace the custom-webpack with @angular-devkit/build-angular, persistent cache works. I also noted the first build take much longer (22minutes) when using @angular-builders/custom-webpack compare to @angular-devkit/build-angular (10mins)

The error come from here :
image

The same issue also happens when I use @Angular-builder/custom-webpack 12.1.0

image

Eventually, the build completed but it doesnt look like there is any cache restore happens as seen from the capture above
angular.json
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
//"builder": "@angular-devkit/build-angular:browser",
"options": {
"customWebpackConfig": {
"path": "./webpack.config.js",
"mergeRules": {
"output": "replace",
"entry": "replace"
},
"replaceDuplicatePlugins": true
},
"outputPath": "./dev-build",
"index": "",
"main": "app/silverlight/silverlight.bootstrap.ts",
"polyfills": "app/polyfills.ts",
"tsConfig": "./tsconfig.json",
"inlineStyleLanguage": "scss"

      },
       "configurations": {
        "production": {
          "customWebpackConfig": {
            "path": "./webpack.config.production.js",
            "mergeRules": {
              "output": "replace",
              "entry": "replace"
            },
            "replaceDuplicatePlugins": true
          },
          "fileReplacements": [
            {
              "replace": "./app/environments/environment.ts",
              "with": "./app/environments/environment.prod.ts"
            }
          ],
          "optimization": {
            "scripts": true,
            "styles": {
              "minify": true,
              "inlineCritical": true
            },
            "fonts": true
          },
          "sourceMap": {
            "hidden": false,
            "styles": false
          },
          "outputHashing": "all",
          "namedChunks": false,
          "extractLicenses": false,
          "vendorChunk": true,
          "buildOptimizer": true,
          "aot": true,
          "assets": []
        },
        "development": {
          "buildOptimizer": false,
          "optimization": false,
          "vendorChunk": true,
          "extractLicenses": false,
          "sourceMap": true,
          "namedChunks": false
        },

      "defaultConfiguration": "development"
    },,
    "serve": {
      //"builder": "@angular-devkit/build-angular:dev-server",
      "builder": "@angular-builders/custom-webpack:dev-server",
      "options": {
        "port": 9090,
        "proxyConfig": "app/proxy.config.js",
        "servePath": "dev-build/"
      },
      "configurations": {
        "production": {
          "browserTarget": "app:build:production"
        },
        "development": {
          "browserTarget": "app:build:development"
        }
      },
      "defaultConfiguration": "development"
    },

  }

Expected Behavior

Persistent cache restore cache item successfully. The build time should reduce as the result of Persistent caching working

@just-jeb
Copy link
Owner

Is there a possibility your custom webpack config affects the build? What if you use custom-webpack builder but the custom config is empty?

@KhoaSydney
Copy link
Author

KhoaSydney commented Jul 13, 2021

@just-jeb I commented out my custom webpack config module.exports = {} and it still doesnt work (take a long time with persistent cache turn on). I think this must be related to custom webpack. I also came across a comment here where the user said the custom webpack causes performance issue angular/angular-cli#20792 (comment)

@just-jeb
Copy link
Owner

just-jeb commented Jul 18, 2021

Hey, thanks for checking it out for me. I can't think of anything that would cause the custom-webpack multiply the build time.
Any chance you can try clean install (with removing the package-lock.json) like they did here?
If it still doesn't help I'm gonna need a reproduction.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants