question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular v13 Sass issue (SassError: Can't find stylesheet to import)

See original GitHub issue

Hello, I have recently updated @mat-datetimepicker/core to v9.0.2 and I’m getting following error from sass-loader (Note: The build is working with v7.0.1).

Error

./src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./src/styles.scss - Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
  ╷
6 │ @import "~@mat-datetimepicker/core/datetimepicker/datetimepicker-theme.scss";
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  src/theme/_angular.scss 6:9  @import
  src/theme/_main.scss 1:9     @import
  src/styles.scss 1:9          root stylesheet

./src/styles.scss - Error: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
HookWebpackError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.

Version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 13.1.2
Node: 12.22.1
Package Manager: npm 6.14.12
OS: win32 x64

Angular: 13.1.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... localize, material, material-moment-adapter
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------       
@angular-devkit/architect       0.1301.2
@angular-devkit/build-angular   13.1.2
@angular-devkit/core            13.1.2
@angular-devkit/schematics      13.1.2
@angular/cli                    13.1.2
@angular/flex-layout            13.0.0-beta.36
@schematics/angular             13.1.2
rxjs                            7.5.1
typescript                      4.5.4

I don’t know what is causing this issue, you will find below my styles.scss:

@use '@angular/material' as mat;

@import "~@mat-datetimepicker/core/datetimepicker/datetimepicker-theme.scss";

@include mat.core();

@include mat-datetimepicker-theme($app-light-theme);
@include mat.all-component-themes($app-light-theme);

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
bborttcommented, Jan 10, 2022

@alexis-landrieu-avanade I’ve added the export flag and that seems to work (tested it using your sample)! fix released in v9.0.22. thanks much for your help.

2reactions
alexis-landrieu-avanadecommented, Jan 19, 2022

@bbortt I think the Theming part of the README.md file must be updated,

Theming

@use '@mat-datetimepicker/core/datetimepicker/datetimepicker-theme' as matdp;

// Using the $theme variable from the pre-built theme you can call the theming function
@include matdp.mat-datetimepicker-theme($theme);

@JorgeAlcarazKuv see full example

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't find stylesheet to import. @use '~@angular/material ...
For Angular 13 try to remove tilde symbol ( ~ ) from the path so import like: @use '@angular/material' as mat;. It works...
Read more >
SassError: Can't find stylesheet to import on Angular 13 · ...
Describe the bug I just upgraded to Angular 13 and Storybook now fails to build: SassError: Can't find stylesheet to import. ╷ 1...
Read more >
Executing Sass - Can't find stylesheet to import
Hi :) I'm currently trying to do the following: code.png. So I import the base styles, then I override some scss variables, and...
Read more >
[Solved]-Angular upgrade own library from 12 to 13 scss Error ...
Coding example for the question Angular upgrade own library from 12 to 13 scss Error 'SassError: Can't find stylesheet to import.'-angular.js.
Read more >
Sass Error after upgrading vom v14 to v15
SassError : Can't find stylesheet to import. ... node_modules\@infragistics\igniteui-angular\lib\core\styles\themes\_core.scss 7:1 @forward
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found