Fluentui: Cannot use different versions of office-ui-fabric-react together in Rush

Created on 5 Jul 2019  路  64Comments  路  Source: microsoft/fluentui

Environment Information

  • __Package version(s)__: ^5.113.1, ^7.6.3, probably 6.x too.
  • __Browser and OS versions__: Windows

Please provide a reproduction of the bug in a codepen:

  1. Not a codepen, but a git repo. Check out RushWithMultipleFabricVersions.
  2. Run rush install.
  3. Run rush build.

Actual behavior:

The build will fail with an error like:

ERROR in C:\Users\hegi\source\repos\test-multiple-react\packages\test-15\src\index.tsx
./src/index.tsx
[tsl] ERROR in C:\Users\hegi\source\repos\test-multiple-react\packages\test-15\src\index.tsx(8,5)
      TS2605: JSX element type 'PrimaryButton' is not a constructor function for JSX elements.
  Type 'PrimaryButton' is missing the following properties from type 'ElementClass': setState, forceUpdate, props, state, and 2 more.

ERROR in C:\Users\hegi\source\repos\test-multiple-react\packages\test-15\src\index.tsx
./src/index.tsx
[tsl] ERROR in C:\Users\hegi\source\repos\test-multiple-react\packages\test-15\src\index.tsx(8,5)
      TS2607: JSX element class does not support attributes because it does not have a 'props' property.

Expected behavior:

The build should succeed. If you open /rush.json and comment out one of the projects, either test-15 or test-16 then the build will succeed on the uncommented project.

Priorities and help requested:

I originally opened Issue 1351 on the Rush team, but @octogonz said it was an issue with phantom dependencies.

Are you willing to submit a PR to fix? No.

Requested priority: Normal

Products/sites affected: Internal development is slower since we can't use rush for projects with multiple UI fabric versions.

Build System Fixed Type

Most helpful comment

I do believe phantom dependencies are the problem here because of how rush symlinks them.

This issue isn't Rush-specific or PNPM-specific. Phantom dependencies will be a problem for /any/ package manager that's installing side-by-side versions: If the package.json doesn't declare what version of the typings it needs, then there will always exist scenarios where it will get the wrong version.

People commonly disregard phantom dependencies because, in their simple setup, they don't usually need to install side-by-side versions. In a simple setup, the incorrect package.json happens to produce the right result. But it's nonetheless an incorrect package.json.

All 64 comments

Hi @HarryGifford, thanks for filing the issue!

I do believe phantom dependencies are the problem here because of how rush symlinks them. @kenotron do you have any idea on how to circumvent this issue?

I've seen some goober from the pnpm / rush combo getting written into shrinkwrap.yml file. This is the source of the issue. Without having to manually modify the shrinkwrap file, I'm not sure how to clear it all. When we blew away shrinkwrap and re-rush-install at the beginning of 7.x branch, we had a clean set of deps. Maybe we can do a blow away & recommit exercise here again.

I do believe phantom dependencies are the problem here because of how rush symlinks them.

This issue isn't Rush-specific or PNPM-specific. Phantom dependencies will be a problem for /any/ package manager that's installing side-by-side versions: If the package.json doesn't declare what version of the typings it needs, then there will always exist scenarios where it will get the wrong version.

People commonly disregard phantom dependencies because, in their simple setup, they don't usually need to install side-by-side versions. In a simple setup, the incorrect package.json happens to produce the right result. But it's nonetheless an incorrect package.json.

In case it wasn't clear, the fix is to change this:

  "peerDependencies": {
    "react": "^0.14.9 || ^15.0.1-0 || ^16.0.0-0",
    "react-dom": "^0.14.9 || ^15.0.1-0 || ^16.0.0-0"
  }

...to something like this:

  "peerDependencies": {
    "@types/react": "^0.14.x || ^15.x || ^16.x",
    "@types/react-dom": "^0.14.x || ^15.x || ^16.x",
    "react": "^0.14.9 || ^15.0.1-0 || ^16.0.0-0",
    "react-dom": "^0.14.9 || ^15.0.1-0 || ^16.0.0-0"
  }

This is needed for all packages that export TypeScript signatures that refer to @react/ typings.

@khmakoto Thanks for the quick fix! Are you willing to backport this to fabric 5 and 6?

@HarryGifford for sure, I'll make a PR for that as soon as I can.

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as [email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9855, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

@khmakoto One last one, could you backport to Fabric 5 as well? We still have some code that we've not moved to 6 or 7 yet.

:tada:This issue was addressed in #9975, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9975, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9975, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9975, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9975, which has now been successfully released as [email protected].:tada:

Handy links:

:tada:This issue was addressed in #9975, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9975, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

:tada:This issue was addressed in #9798, which has now been successfully released as @uifabric/[email protected].:tada:

Handy links:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeremy-coleman picture jeremy-coleman  路  63Comments

JoshuaKGoldberg picture JoshuaKGoldberg  路  33Comments

just-joshing picture just-joshing  路  35Comments

lukasbash picture lukasbash  路  31Comments

just-joshing picture just-joshing  路  35Comments