[Bug]: New npm install cause error on @floating-ui/devtools
Library
React Components / v9 (@fluentui/react-components)
System Info
System:
OS: Windows 11 10.0.22621
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 440.63 MB / 31.73 GB
Browsers:
Edge: Chromium (120.0.2210.77)
Internet Explorer: 11.0.22621.1
Are you reporting Accessibility issue?
None
Reproduction
not applicable
Bug Description
After a new npm install on a existant SPFx project who use Fluent UI9 cause error on launch server :
Error - [webpack] 'dist':
./node_modules/@floating-ui/devtools/dist/index.js 34:166
Module parse failed: Unexpected token (34:166)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| var r;
| const o = e;
> return !!((r = o == null ? void 0 : o.ownerDocument) != null && r.defaultView && o instanceof o.ownerDocument.defaultView[(n == null ? void 0 : n.constructorName) ?? "HTMLElement"]);
| }
| const E = () => `${i}:${crypto.randomUUID()}`, w = () => {
@ ./node_modules/@fluentui/react-positioning/lib/usePositioning.js 8:0-49 181:71-79
@ ./node_modules/@fluentui/react-positioning/lib/index.js
@ ./node_modules/@fluentui/react-components/lib/index.js
@ ./lib/webparts/controlsTest/ControlsTestWebPart.js`
It worked yesterday, but not today with new install without change on project.
Could it come from this PR? https://github.com/microsoft/fluentui/pull/30107
Logs
No response
Requested priority
Blocking
Products/sites affected
SPFx
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.
- [ ] The provided reproduction is a minimal reproducible example of the bug.
I have the same issue. After upgrading to version 9.43.2. Version 9.37.4 works fine. SPFX version - 1.18.2
Error - [webpack] 'dist':
./node_modules/@floating-ui/devtools/dist/index.js 34:166
Module parse failed: Unexpected token (34:166)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| var r;
| const o = e;
> return !!((r = o == null ? void 0 : o.ownerDocument) != null && r.defaultView && o instanceof o.ownerDocument.defaultView[(n == null ? void 0 : n.constructorName) ?? "HTMLElement"]);
| }
| const E = () => `${i}:${crypto.randomUUID()}`, w = () => {
@ ./node_modules/@fluentui/react-positioning/lib/usePositioning.js 8:0-49 181:71-79
@ ./node_modules/@fluentui/react-positioning/lib/index.js
@ ./node_modules/@fluentui/react-components/lib/index.js
I have the same issue with 9.43.2 version
Bug must of been fairly recent as it was working fine on 9.42 2 weeks ago. Overrides if you want to use the latest with SPFX while we wait for a fix
package.json
{
...
"overrides": {
"@fluentui/react-positioning": "9.10.2",
"@fluentui/react-combobox": "9.5.35",
"@fluentui/react-popover": "9.8.23",
"@fluentui/react-menu": "9.12.37",
"@fluentui/react-tooltip": "9.4.3"
}
}
Same issue here when updated to 9.43.3 version
Same issue. was working a few days ago. spfx 1.18 or 1.18.2
Same issue.
I found the issue, Nullish coalescing operator makes package incompatible with webpack 4 my suggestion to fluent ui team: I suggest to fix @floating-ui/devtools so it will be compatible with webpack 4. at line 34 (@floating-ui/devtools/dist/index.js 34), please replace the Nullish coalescing operator with ternary operator (? :)
I have the same issue reported.
I updated to webpack 5. And it solved the issue.
Bug must of been fairly recent as it was working fine on 9.42 2 weeks ago. Overrides if you want to use the latest with SPFX while we wait for a fix
package.json{ ... "overrides": { "@fluentui/react-positioning@>9.10.2": "9.10.2", "@fluentui/react-combobox": "9.5.35", "@fluentui/react-popover": "9.8.23", "@fluentui/react-menu": "9.12.37", "@fluentui/react-tooltip": "9.4.3" } }
This fixed it for the time being. Be careful with the package-lock.json that might be refering diferent versions. I had a problem with that.
Bug must of been fairly recent as it was working fine on 9.42 2 weeks ago. Overrides if you want to use the latest with SPFX while we wait for a fix
package.json{ ... "overrides": { "@fluentui/react-positioning": "9.10.2", "@fluentui/react-combobox": "9.5.35", "@fluentui/react-popover": "9.8.23", "@fluentui/react-menu": "9.12.37", "@fluentui/react-tooltip": "9.4.3" } }This fixed it for the time being. Be careful with the package-lock.json that might be refering diferent versions. I had a problem with that.
npm i then npm dedup
I updated to webpack "npm i [email protected]" And it solved the issue.
webpack update didn't work for me @vipul1984. I have updated the positioning override as it wasn't working with the latest build
react-components 9.44.1 was just released with an updated devtools
https://www.npmjs.com/package/@fluentui/react-components/v/9.44.1
That should resolve this issue
Thanks @micahgodbolt that does indeed seem to have resolved the SPFX issue
Closing since the issue seems to now be solved.
It's work with latest version (9.44.1)