[Bug]: Webpack fails with export 'useInsertionEffect' (imported as 'React') was not found in 'react
in React 17 app
#25283
Labels
Fluent UI react (v8)
Issues about @fluentui/react (v8)
Fluent UI react-components (v9)
Needs: Triage 🔍
React 18
Status: Fixed
Fixed in some PR
Library
React Components / v9 (@fluentui/react-components)
System Info
Are you reporting Accessibility issue?
no
Reproduction
See description
Bug Description
Actual Behavior
Repro:
yarn
to install/update all depsyarn workspace @fluentui/stress-test stress-test dev
http://localhost:9000/v9/stress-tree?r=button&fixtureName=xs_1&test=mount
The issue appears to be caused by this line in useFluentProviderThemeStyleTag. A similar issue was logged a while back against Emotion and Fluent uses the same technique to avoid this problem so I think the code is okay.
One recent change in stress-test is to use
swc-loader
to process Typescript/React. Looking into the generated code reveals:It appears to be doing something clever here to avoid the string concatenation. After reading the SWC docs it's not clear that there is a way to disable this behavior (if it is indeed an issue with SWC).
This may also be related to the recent update to allow React 18 support (#24976, #24972)
Expected Behavior
I should be able to use fluentui/react and fluentui/react-components in a React 17 app.
Logs
No response
Requested priority
Normal
Products/sites affected
No response
Are you willing to submit a PR to fix?
yes
Validations
The text was updated successfully, but these errors were encountered: