sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Error can't find stylesheet to import

Open mtspsn opened this issue 3 years ago • 8 comments

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Developer environment

Windows

What browser(s) / client(s) have you tested

  • [ ] 💥 Internet Explorer
  • [X] 💥 Microsoft Edge
  • [ ] 💥 Google Chrome
  • [ ] 💥 FireFox
  • [ ] 💥 Safari
  • [ ] mobile (iOS/iPadOS)
  • [ ] mobile (Android)
  • [ ] not applicable
  • [ ] other (enter in the "Additional environment details" area below)

Additional environment details

  • browser version: 112.0.1722.58
  • SPFx version: 1.17.1
  • Node.js version: v16.10.0

Describe the bug / error

When using the sharepoint generator 1.17.1 to build a web part the project cannot be built because of following error:

Error - sass - src\webparts\samTest\components\SamTest.module.scss(1,9): error Error: Can't find stylesheet to import. @import '~@fluentui/react/dist/sass/References.scss'; src\webparts\samTest\components\SamTest.module.scss 1:9 root stylesheet

When checking the package.json dependencies there is no fluentui but "office-ui-fabric-react": "^7.199.1" When checking the node_modules folder @fluentui/react there is no dist folder

Steps to reproduce

  1. yo @microsoft/sharepoint
  2. type client-side component -> WebPart
  3. template -> React

Expected behavior

The default project created by the generator should be built without any errors.

mtspsn avatar May 02 '23 11:05 mtspsn

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ghost avatar May 02 '23 11:05 ghost

@mtspsn - thank you for reporting the issue. We are aware of the regression appeared and are working on the fix. In a meawhile you can replace @fluentui/react with office-ui-fabric-react - it should resolve the issue.

AJIXuMuK avatar May 02 '23 13:05 AJIXuMuK

@mtspsn - just to shed some light - the issue is due to the latest release of Fluent UI React (v8.109.0) that is indirectly referenced in SPFx solutions. This version is missing some JS bits.

AJIXuMuK avatar May 02 '23 18:05 AJIXuMuK

The other fix us just to run npm i @fluentui/[email protected] on the project and then no changes are needed in the generated code,

BobFleischman avatar May 02 '23 22:05 BobFleischman

or replace the import statement with @import '~office-ui-fabric-react/dist/sass/_References.scss';

Notice the underscore before the term 'References'

BobFleischman avatar May 02 '23 22:05 BobFleischman

@AJIXuMuK #8945 is not a dupe of this one. This issue targets a regression specific to @fluentui/react dependency, while my issue concerns phantom dependencies. @fluentui/react is only part of the missing dependencies and the focus is not specific to it.

stevebeauge avatar May 03 '23 21:05 stevebeauge

fixed in 1.17.2

AJIXuMuK avatar May 09 '23 13:05 AJIXuMuK

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

ghost avatar May 16 '23 18:05 ghost