Error can't find stylesheet to import
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
- yo @microsoft/sharepoint
- type client-side component -> WebPart
- template -> React
Expected behavior
The default project created by the generator should be built without any errors.
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
@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.
@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.
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,
or replace the import statement with @import '~office-ui-fabric-react/dist/sass/_References.scss';
Notice the underscore before the term 'References'
@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.
fixed in 1.17.2
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