Error upgrading from angular 11.2 to 12.2 - styles.css - Error: (0 , _identifier.getUndoPath) is not a function

Viewed 2983

Like the title says, I'm getting an error building my angular app after using the ng cli to upgrade from angular 11.2 to 12.2:

styles.css - Error: (0 , _identifier.getUndoPath) is not a function

I don't have a styles.css file (using styles.scss), nor do I see anywhere that file is referenced. Any idea what the issue could be?

7 Answers

@angular-devkit/build-angular@12.2.0 seems to be the issue. Downgrading it to 12.1.1 fixes the issue for me (while the Angular team fixes the real thing)

for me downgrading the @angular-devkit/build-angular package didn't work, but I looked a little dipper, and I see that webpack is calling this function, so I upgraded the webpack package ("webpack": "^5.50.0"), and this solved the problem.

my version is v12.2.7, and the solution is npm i webpack

You might want to check if styles.css is being imported and used anywhere inside your code.

When I upgraded my angular framework to 12, I struggled with many scss problems. The problem is that the @angular/cli package interprets the packages in the assets folder as external links. I have now downgraded my angular version to 11. If you can manage to interpret your assets directory as , the problem may be solved.

something like this in angular.json

"assets": [
              ...
              {
                "glob": "**/*.scss",
                "input": "src/assets/",
                "ignore": ["**/*.scss"],
                "output": "/assets/"
              },
              {
                "glob": "**/*.md",
                "input": "docs",
                "output": "/assets/docs"
              }
            ],

Related