Topic: Error while referencing mdb styles in styles.css

vijay_tenneti premium asked 1 year ago


I installed mdb5 angular pro essential today and when adding the line @import "mdb-angular-ui-kit/assets/scss/mdb.scss"; to styles.css I get the error ./src/styles.css - Error: Module build failed (from ./node_modules/css-loader/dist/cjs.js): Error: Package path ./assets/scss/mdb.scss is not exported from package /Users/vijaytenneti/Documents/GitHub/SaveAndSpendAngular/saveandspend-angular/node_modules/mdb-angular-ui-kit (see exports field in /Users/vijaytenneti/Documents/GitHub/SaveAndSpendAngular/saveandspend-angular/node_modules/mdb-angular-ui-kit/package.json)

./src/styles.css?ngGlobalStyle - Error: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js): HookWebpackError: Module build failed (from ./node_modules/css-loader/dist/cjs.js): Error: Can't resolve '~mdb-angular-ui-kit/assets/scss/mdb.scss' in '/Users/vijaytenneti/Documents/GitHub/SaveAndSpendAngular/saveandspend-angular/src’

on ng serve

Please can you help?

If you use MDB5 Angular v4.0.0 with Angular 15 (or v3 with Angular 14) please make sure to remove the tilde (~) from scss import path. Here is the correct path:

@import 'mdb-angular-ui-kit/assets/scss/mdb.scss';

vijay_tenneti premium commented 1 year ago

Sorry I already tried this (before contacting support) - I get the same error.

Arkadiusz Idzikowski staff commented 1 year ago

Which MDB and Angular versions do you use? I just tested that in the app with MDB Angular v4.0.0 and Angular v15 and I could not reproduce such a problem.

We also did not change the styles export configuration in the latest updates so it is really strange if it suddenly stopped working.

Please try to remove node_modules folder and package-lock.json file and try to reinstall all dependencies with npm install command. Make sure to install required Angular version (we require v15 for apps using MDB Angular v4). If you need to use older Angular version you can adjust our installation command to always install specific MDB version:

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Premium
  • Premium support: Yes
  • Technology: MDB Angular
  • MDB Version: MDB5 4.0.0
  • Device: any
  • Browser: any
  • OS: any
  • Provided sample code: No
  • Provided link: No