fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

[Bug]: New npm install cause error on @floating-ui/devtools

Open rgcircum opened this issue 2 years ago • 17 comments

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.

rgcircum avatar Dec 19 '23 12:12 rgcircum

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

bva999 avatar Dec 21 '23 11:12 bva999

I have the same issue with 9.43.2 version

VictorRomanov1986 avatar Dec 21 '23 16:12 VictorRomanov1986

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"
  }
}

techienickb avatar Dec 25 '23 19:12 techienickb

Same issue here when updated to 9.43.3 version

joaquinajenjo avatar Dec 27 '23 10:12 joaquinajenjo

Same issue. was working a few days ago. spfx 1.18 or 1.18.2

Mike-MvL avatar Dec 28 '23 08:12 Mike-MvL

Same issue.

adelKhatib avatar Dec 30 '23 12:12 adelKhatib

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 (? :)

adelKhatib avatar Dec 30 '23 13:12 adelKhatib

I have the same issue reported.

pjorgesilvaa avatar Jan 05 '24 09:01 pjorgesilvaa

I updated to webpack 5. And it solved the issue.

adelKhatib avatar Jan 05 '24 10:01 adelKhatib

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.

pjorgesilvaa avatar Jan 05 '24 14:01 pjorgesilvaa

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

techienickb avatar Jan 05 '24 17:01 techienickb

I updated to webpack "npm i [email protected]" And it solved the issue.

vipul1984 avatar Jan 06 '24 14:01 vipul1984

webpack update didn't work for me @vipul1984. I have updated the positioning override as it wasn't working with the latest build

techienickb avatar Jan 06 '24 16:01 techienickb

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

micahgodbolt avatar Jan 08 '24 17:01 micahgodbolt

Thanks @micahgodbolt that does indeed seem to have resolved the SPFX issue

techienickb avatar Jan 08 '24 17:01 techienickb

Closing since the issue seems to now be solved.

khmakoto avatar Jan 08 '24 19:01 khmakoto

It's work with latest version (9.44.1)

rgcircum avatar Jan 10 '24 08:01 rgcircum