2

I've tried to migrate Angular 13 to Angular 15 and after this I get error message:

./node_modules/@app/app-core/theme/app-theme.scss - Error: Module build failed (from ./node_modules/css-loader/dist/cjs.js): Error: Can't resolve 'node_modules/@angular/cdk/overlay-prebuilt.css' in '/Users/user/node_modules/@app/app-core/theme'

Angular.json file has configurations:

"assets": [
  "src/assets",
  {
    "glob": "**",
    "input": "node_modules/@app/app-core/theme",
    "output": "app-core"
  }
],
"styles": [
  "node_modules/@app/app-core/theme/app-theme.scss",
  "src/styles.sass"
],

In app-theme.scss:

@import 'font-family';
@import 'variables';
@import 'reboot';
@import 'mixins';
@import 'node_modules/@angular/cdk/overlay-prebuilt.css';
@import 'buttons';
@import '_grid';
@import '_container';
@import 'main';

app-theme.scss is file which I import to my app and I can't change it globally but if I changed locally:

@import 'node_modules/@angular/cdk/overlay-prebuilt.css';

to

@import '~@angular/cdk/overlay-prebuilt.css';

The problem didn't occur and app is running.

I've tried deleting node-modules and package-lock.json and reinstall all dependencies but it doesn't work.

0 Answers0