microsoft / fluentui-contrib

Monorepo for contributor extension packages to Fluent UI
MIT License
29 stars 31 forks source link

Error: Cannot find module '@fluentui/react-shared-contexts' #184

Open HermanNygaard opened 3 months ago

HermanNygaard commented 3 months ago

Error: Cannot find module '@fluentui/react-shared-contexts' at webpackMissingModule (emotion-hash.esm.js:55:1) at ../../.store/@fluentui-contrib-react-headless-provider@1.0.2-0813d41f07b7b138d557/node_modules/@fluentui-contrib/react-headless-provider/lib/components/HeadlessFluentProvider/HeadlessFluentProvider.js (emotion-hash.esm.js:55:1) at webpack_require (bootstrap:19:1) at ./src/Components/AppContainer.tsx (App.tsx:45:1) at webpack_require (bootstrap:19:1) at ./src/Components/App.tsx (tracing.js:7:1) at __webpack_require__ (bootstrap:19:1) at index.js:320:1 at index.tsx:5:1 at index.tsx:5:1

When trying to import HeadlessFluentProvider import { HeadlessFluentProvider } from "@fluentui-contrib/react-headless-provider";

   "@fluentui-contrib/react-headless-provider": "^1.0.2",
   "@fluentui/react-components": "^9.46.3",
   "react": "~17.0.2",
   "react-dom": "~17.0.2",

I see the error goes away if I manually install the package and import it, but shouldn't this be a dependency of react-components?

miroslavstastny commented 3 months ago

@fluentui-contrib/react-headless-provider should not have direct dependency on @fluentui/react-shared-contexts

Hotell commented 2 months ago

. I see the error goes away if I manually install the package and import it

that works as expected. context is a peer dependency ( singleton ) - we cannot ship multiple singletons as that would explode in user land. you need to install all peerDependencies explicitly in your application.

but shouldn't this be a dependency of react-components?

it is. wondering why it's used as direct sub-package import @layershifter ?

layershifter commented 2 months ago

but shouldn't this be a dependency of react-components?

it is. wondering why it's used as direct sub-package import @layershifter ?

Some bits of API are not available through @fluentui/react-components. We need to export them and update @fluentui-contrib/react-headless-provider to import only @fluentui/react-components.