Angular 16 – ‘The theme for #{map.get($map, ‘name’)} does not contain #{$key}’;

I am in the process of trying to upgrade from Angular version 15 to 16. After updating the necessary packages I am getting the error:

HookWebpackError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Undefined variable.

117 │ @error ‘The theme for #{map.get($map, ‘name’)} does not contain #{$key}’;
│ ^^^^

node_modulesigniteui-themingsassthemes_functions.scss 117:41 var-get()
node_modules@infragisticsigniteui-angularlibcorestylescomponentsbottom-nav_bottom-nav-theme.scss 125:16 bottom-nav()
node_modules@infragisticsigniteui-angularlibcorestylesthemesgenerators_base.scss 155:9 theme-internal()
node_modules@infragisticsigniteui-angularlibcorestylesthemesgenerators_base.scss 42:5 theme()
node_modules@infragisticsigniteui-angularlibcorestylesthemesgenerators_base.scss 667:5 light-theme()
srcstylesrhi-light-theme.scss 6:3 @import
srcstyles.scss 23:9 root stylesheet

My styles.scss is set as below:

//rhi styles

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>@import './styles/rhi';
// igx-color function has been renamed to color which is the same as the bootstrap function. Declare all infragistics colours before importing bootstrap.
// Bootstrap
@import "node_modules/bootstrap/scss/bootstrap";
// IMPORTANT: Make sure you always include igx-core first!
@include core();
// Configure application fonts with igx-typography
@include typography(
$font-family: "'Montserrat', sans-serif",
$type-scale: $rhi-type-scale
);
// Initialise ignite ui themes
@include theme($rhi-color-palette);
//Import rhi themes
@import './styles/rhi-light-theme';
@import './styles/rhi-dark-theme';
</code>
<code>@import './styles/rhi'; // igx-color function has been renamed to color which is the same as the bootstrap function. Declare all infragistics colours before importing bootstrap. // Bootstrap @import "node_modules/bootstrap/scss/bootstrap"; // IMPORTANT: Make sure you always include igx-core first! @include core(); // Configure application fonts with igx-typography @include typography( $font-family: "'Montserrat', sans-serif", $type-scale: $rhi-type-scale ); // Initialise ignite ui themes @include theme($rhi-color-palette); //Import rhi themes @import './styles/rhi-light-theme'; @import './styles/rhi-dark-theme'; </code>
@import './styles/rhi';

// igx-color function has been renamed to color which is the same as the bootstrap function. Declare all infragistics colours before importing bootstrap.
// Bootstrap
@import "node_modules/bootstrap/scss/bootstrap";

// IMPORTANT: Make sure you always include igx-core first!
@include core();

// Configure application fonts with igx-typography
@include typography(
    $font-family: "'Montserrat', sans-serif",
    $type-scale: $rhi-type-scale
);

// Initialise ignite ui themes
@include theme($rhi-color-palette);

//Import rhi themes
@import './styles/rhi-light-theme';
@import './styles/rhi-dark-theme';

The issue seems to be specifically with:

$rhi-color-palette

in rhi.scss I have:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>// Import the IgniteUI themes library first
@use '@infragistics/igniteui-angular/theming' as *;
@forward '@infragistics/igniteui-angular/theming';
// CSS Reset, comment out if not required or using a different module
@import 'node_modules/minireset.css/minireset';
// Import our defined palettes and schemas
@import './igx-palettes';
@import './igx-type-scales.scss';
.....
</code>
<code>// Import the IgniteUI themes library first @use '@infragistics/igniteui-angular/theming' as *; @forward '@infragistics/igniteui-angular/theming'; // CSS Reset, comment out if not required or using a different module @import 'node_modules/minireset.css/minireset'; // Import our defined palettes and schemas @import './igx-palettes'; @import './igx-type-scales.scss'; ..... </code>
// Import the IgniteUI themes library first
@use '@infragistics/igniteui-angular/theming' as *;
@forward '@infragistics/igniteui-angular/theming';

// CSS Reset, comment out if not required or using a different module
@import 'node_modules/minireset.css/minireset';

// Import our defined palettes and schemas
@import './igx-palettes';
@import './igx-type-scales.scss';
.....

in igx-palettes.scss we have:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>$rhi-color-palette: palette(
$primary: $rhi-blue-color,
$secondary: $rhi-pink-color,
$surface: #fff,
$info: color($light-material-palette, 'info'),
$success: color($light-material-palette, 'success'),
$error: color($light-material-palette, 'error'),
$warn: color($light-material-palette, 'warn'),
);
$rhi-color-palette-dark: palette(
$primary: $rhi-pink-color,
$secondary: $rhi-pink-color,
$gray: $white-color,
$surface: #222,
$info: color($light-material-palette, 'info'),
$success: color($light-material-palette, 'success'),
$error: color($light-material-palette, 'error'),
$warn: color($light-material-palette, 'warn'),
);
</code>
<code>$rhi-color-palette: palette( $primary: $rhi-blue-color, $secondary: $rhi-pink-color, $surface: #fff, $info: color($light-material-palette, 'info'), $success: color($light-material-palette, 'success'), $error: color($light-material-palette, 'error'), $warn: color($light-material-palette, 'warn'), ); $rhi-color-palette-dark: palette( $primary: $rhi-pink-color, $secondary: $rhi-pink-color, $gray: $white-color, $surface: #222, $info: color($light-material-palette, 'info'), $success: color($light-material-palette, 'success'), $error: color($light-material-palette, 'error'), $warn: color($light-material-palette, 'warn'), ); </code>
$rhi-color-palette: palette(
    $primary: $rhi-blue-color,
    $secondary: $rhi-pink-color,
    $surface: #fff,
    $info: color($light-material-palette, 'info'),
    $success: color($light-material-palette, 'success'),
    $error: color($light-material-palette, 'error'),
    $warn: color($light-material-palette, 'warn'),
);

$rhi-color-palette-dark: palette(
    $primary: $rhi-pink-color,
    $secondary: $rhi-pink-color,
    $gray: $white-color,
    $surface: #222,
    $info: color($light-material-palette, 'info'),
    $success: color($light-material-palette, 'success'),
    $error: color($light-material-palette, 'error'),
    $warn: color($light-material-palette, 'warn'),
);

and then in the light-theme.scss there is:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>.rhi-light-theme {
@include light-theme($rhi-color-palette);
</code>
<code>.rhi-light-theme { @include light-theme($rhi-color-palette); </code>
.rhi-light-theme {
  @include light-theme($rhi-color-palette);

…..

and in dark-theme.scss:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>.rhi-dark-theme {
@include dark-theme($rhi-color-palette-dark);
</code>
<code>.rhi-dark-theme { @include dark-theme($rhi-color-palette-dark); </code>
.rhi-dark-theme {
 @include dark-theme($rhi-color-palette-dark);

…..

I know it’s to do with
$rhi-color-palette as if I remove these lines from styles.scss:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>@include theme($rhi-color-palette);
@import './styles/rhi-light-theme';
@import './styles/rhi-dark-theme';
</code>
<code>@include theme($rhi-color-palette); @import './styles/rhi-light-theme'; @import './styles/rhi-dark-theme'; </code>
@include theme($rhi-color-palette);

@import './styles/rhi-light-theme';
@import './styles/rhi-dark-theme';

then the application will build.

And then also within the light theme file and dark theme files, if I remove the lines:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> @include light-theme($rhi-color-palette);
@include dark-theme($rhi-color-palette-dark);
</code>
<code> @include light-theme($rhi-color-palette); @include dark-theme($rhi-color-palette-dark); </code>
  @include light-theme($rhi-color-palette);
 @include dark-theme($rhi-color-palette-dark);

then I can still include the lines

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>@import './styles/rhi-light-theme';
@import './styles/rhi-dark-theme';
</code>
<code>@import './styles/rhi-light-theme'; @import './styles/rhi-dark-theme'; </code>
@import './styles/rhi-light-theme';
@import './styles/rhi-dark-theme';

in styles.scss and it will build. So the issue seems to stem to how the palette is set up but I’m not sure what needs to change?

Figured out the issue. It wasn’t anything to do with how the scss is set up but rather using an incompatible version of igniteui-theming. It had to be changed to version 3.3.3. Once this was don, I no longer got that error and it the application builds

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật