Migration to Angular Material 18 fails due to invalid regular expression in define-light-theme migration #30921
Closed
1 task done
Labels
needs triage
This issue needs to be triaged by the team
Is this a regression?
The previous version in which this bug was not present was
Yes, the previous migration from Angular Material 16 → 17 worked correctly. Angular Material 17.3.10
Description
When running the migration command to update @angular/material from version 17 to 18 using the Angular CLI, the process fails with the following error:
× Migration failed: Invalid regular expression: /*.define-light-theme(/: Nothing to repeat
It seems the migration script contains an invalid regular expression targeting define-light-theme() usage in SCSS files, possibly due to an unescaped / or *.
Reproduction
Expected Behavior
The migration should correctly scan SCSS files and apply changes (if necessary) without failing due to a malformed regular expression.
Actual Behavior
The update process is interrupted due to a JavaScript exception caused by an invalid regular expression:
Invalid regular expression: /*.define-light-theme(/: Nothing to repeat
As a result, no migration is applied and developers must manually adjust their styles.
Environment
Angular CLI: 18.x
Node: 18.19.0
OS: Windows 10
Package manager: npm
Project Angular version: 18.2.14
@angular/material: 17.3.10 → 18.2.14
@angular/cdk: 17.3.10 → 18.2.14
The text was updated successfully, but these errors were encountered: