[Bug]: "@fluentui/react" is unusable
Library
React / v8 (@fluentui/react)
System Info
System:
OS: Windows 10 10.0.22000
CPU: (16) x64 Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz
Memory: 9.96 GB / 31.77 GB
Browsers:
Edge: Spartan (44.22000.120.0), Chromium (104.0.1293.63)
Internet Explorer: 11.0.22000.120
Are you reporting Accessibility issue?
no
Reproduction
https://github.com/TonyTroeff/issue-with-fluentui-react
Bug Description
Actual Behavior
My application will not be able to start after an nom install. There are some of the errors I receive:
ERROR in ./node_modules/@fluentui/react/lib/components/TeachingBubble/TeachingBubbleContent.base.js 8:0-73
Module not found: Error: Can't resolve '@fluentui/react-hooks' in 'C:\Data\OneBitSoftware\Quantum.DMS\src\Quantum.DMS.Client\node_modules\@fluentui\react\lib\components\TeachingBubble'
ERROR in ./node_modules/@fluentui/react/lib-commonjs/FocusZone.js 4:20-52
Module not found: Error: Can't resolve '@fluentui/react-focus' in 'C:\Data\OneBitSoftware\Quantum.DMS\src\Quantum.DMS.Client\node_modules\@fluentui\react\lib-commonjs'
ERROR in ./node_modules/@fluentui/react/lib-commonjs/Icons.js 4:24-60
Module not found: Error: Can't resolve '@fluentui/font-icons-mdl2' in 'C:\Data\OneBitSoftware\Quantum.DMS\src\Quantum.DMS.Client\node_modules\@fluentui\react\lib-commonjs'
ERROR in ./node_modules/@fluentui/react/lib-commonjs/Styling.js 6:24-60
Module not found: Error: Can't resolve '@fluentui/style-utilities' in 'C:\Data\OneBitSoftware\Quantum.DMS\src\Quantum.DMS.Client\node_modules\@fluentui\react\lib-commonjs'
And there also are many more warnings:
WARNING in ./node_modules/@fluentui/react/lib/components/Persona/Persona.styles.js 33:21-40
export 'getGlobalClassNames' (imported as 'getGlobalClassNames') was not found in '../../Styling' (possible exports: createTheme, registerDefaultFontFaces)
WARNING in ./node_modules/@fluentui/react/lib/components/Panel/Panel.styles.js 324:34-53
export 'IconFontSizes' (imported as 'IconFontSizes') was not found in '../../Styling' (possible exports: createTheme, registerDefaultFontFaces)
WARNING in ./node_modules/@fluentui/react/lib/components/Panel/Panel.styles.js 298:48-68
export 'ScreenWidthMinMedium' (imported as 'ScreenWidthMinMedium') was not found in '../../Styling' (possible exports: createTheme, registerDefaultFontFaces)
WARNING in ./node_modules/@fluentui/react/lib/components/Panel/Panel.styles.js 296:83-115
export 'AnimationVariables' (imported as 'AnimationVariables') was not found in '../../Styling' (possible exports: createTheme, registerDefaultFontFaces)
Expected Behavior
I would like to be able to use my application. It currently does not start,
Logs
No response
Requested priority
Blocking
Products/sites affected
No response
Are you willing to submit a PR to fix?
no
Validations
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] The provided reproduction is a minimal reproducible example of the bug.
This problem is happen because prod build for npm doesn't include /lib dir

@fonov See example in CodeSandBox, 8.90.0 will also report cannot find error but it runs properly.
on CodeSandBox example run without any errors. But when I add prev version of lib yarn add @fluentui/[email protected] it doesn't help because lib have non lock dependence
"dependencies": {
"@fluentui/keyboard-key": "^0.4.2",
"@fluentui/merge-styles": "^8.5.3",
"@fluentui/set-version": "^8.2.2",
"@fluentui/style-utilities": "^8.7.8",
"@fluentui/utilities": "^8.12.0",
"tslib": "^2.1.0"
},
because of this use lib that also broken, that doesn't have /lib dir
for solve this problem it need to use property resolutions in package.json
"resolutions": {
"@fluentui/react-hooks": "8.6.5",
....
}
}
@fonov You could try:
yarn create react-app my-app --template typescript
cd my-app
yarn add @fluentui/[email protected]
yarn start
It will also causes some runtime errors.
Even:
yarn create react-app my-app --template @fluentui/cra-template
not help.
Anyway, it should not be an expected way of using Fluent UI. I just remember that 8.75.1 runs perfectly. @TonyTroeff If you want solve this issue immediately, try using Fluent UI v9, which is named as @fluentui/react-components.
Note: both v8 and v9 doesn't support React 18 or later, you may need specify the version of react-related packages to >=16.8.0 <18.0.0
@AkiraVoid what does it mean "both v8 and v9 doesn't support React 18 or later"?
@raphael10-collab Fluent UI currently have two major versions, v8 (@fluentui/react) and v9 (@fluentui/react-components), with some other versions (such as Northstar which is like beta of new features, and some elder versions). All versions of Fluent UI don't support React 18 or later (React with version number equal to or bigger than 18.0.0).
v9 will add React 18 support after 9.3.0 (current release is 9.2.0, I am not sure because Fluent UI team seems got stuck in concurrency mode of React 18).
You are using React 16 in your example, but you are importing import ReactDOM from 'react-dom/client'; which is only found in React 18.
And yes, we are still working on React 18 support, so you will have issues installing and using any Fluent UI package with React 18.
@micahgodbolt I tested newest v8 packages in both React 18 and React 17, these errors still occuerd.
As I mentioned here:
@fonov You could try:
yarn create react-app my-app --template typescript cd my-app yarn add @fluentui/[email protected] yarn startIt will also causes some runtime errors.
Even:
yarn create react-app my-app --template @fluentui/cra-templatenot help.
duplicate of #24467
This is set as closed, but the errors are still present for me. I have deleted node_modules and have re-installed @fluentui
Can anyone confirm that this is fixed?
I installed the latest version 8.91.0 still get these same errors. React version is 16 no other dependencies are upgraded only tried fluent ui. I have been trying all V8 versions of fluent ui, but they all give the same errors. This started happening yesterday.
The linked issue https://github.com/microsoft/fluentui/issues/24467 hints that the problem is fixed in 8.91.1