Can't find stylesheet to import after angular upgrade

257 Views Asked by At

When I run

npx ng build @mls-ops/tests

I have an error:

Building Angular Package

× Compiling with Angular sources in Ivy partial compilation mode. Can't find stylesheet to import. ╷ 1 │ @import 'node_modules/@mls-ops/bootstrap/style/_variables.scss'; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ projects\mls-ops\tests\src\lib\components\layout\table\table.component.scss 1:9 root stylesheet

Process finished with exit code 1

My library package.json

{
  "name": "@mls-ops/bootstrap",
  "version": "15.0.0",
  "peerDependencies": {
    "@angular/common": "^15.0.0",
    "@angular/core": "^15.0.0",
  },
  "dependencies": {
    "tslib": "^2.3.0"
  },
}

ng-package.json

{
  "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
  "dest": "../../../dist/mls-ops/bootstrap",
  "assets": [
    "/fonts/",
    "/images/",
    "/style/",
    "LICENSE",
    "README.md"
  ],
  "lib": {
    "entryFile": "src/index.ts"
  }
}

I have added it to my library package.json but it doesn't fix the issue.

 "exports": {
    "./variables": {
      "sass": "./style/_variables.scss"
    }
  }

Before angular migration to v15 it worked fine, help me to fix this import issue

1

There are 1 best solutions below

0
Muhammad Azeem Saleem On

Import bootstrap files like this @import 'bootstrap/scss/bootstrap'; This will import bootstrap.scss file.