Skip to content

Issue: Importing SCSS styles in Angular 20 throws "Can't find stylesheet to import" #2274

@greatromul

Description

@greatromul

I’m having trouble importing styles in my Angular 20 app using SCSS.

I tried following the Sass standard:

@use '@swimlane/ngx-datatable';

But this throws an error during build:

✘ [ERROR] Can't find stylesheet to import.
  ╷
7 │ @use '@swimlane/ngx-datatable';

Apparently, path resolution for @use doesn’t work out of the box. Following advice from Stack Overflow, I changed my imports to:

@use '@swimlane/ngx-datatable/index.css';
@use '@swimlane/ngx-datatable/themes/material.scss';
@use '@swimlane/ngx-datatable/assets/icons.css';

This works when building the app, but fails during unit tests with Karma:

./src/styles.scss - Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Can't find stylesheet to import.
  ╷
7 │ @use '@swimlane/ngx-datatable/index.css';

Could someone provide a clear explanation of how to correctly import SCSS styles from @swimlane/ngx-datatable in Angular 20 for both build and unit tests?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions