Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some necessary NPM modules are not in dependencies in package.json #2613

Open
2 of 6 tasks
MP-msft opened this issue Feb 9, 2023 · 1 comment
Open
2 of 6 tasks

Some necessary NPM modules are not in dependencies in package.json #2613

MP-msft opened this issue Feb 9, 2023 · 1 comment
Assignees

Comments

@MP-msft
Copy link

MP-msft commented Feb 9, 2023

Willing to submit a PR to fix?

  • I am willing to submit a PR to fix

Requested priority

Normal

Products/applications affected

No response

Package version(s)

0.35.18

OS version(s)

No response

Platform

  • iOS
  • macOS
  • win32
  • windows
  • android

Xcode version

No response

Please provide a reproduction of the bug

  1. create a blank RN app (e.g. w/ Expo)
    https://reactnative.dev/docs/environment-setup
  2. change runtime to "classic" -- by default it's "automatic" which will have another runtime issue with "use strict"
    Please see related issue and how to change to "classic" runtime:
    FluentUI in Expo project, pragma and pragmaFrag cannot be set when runtime is automatic #1891
    image
  3. install Fluent UI React Native and start on iOS (iOS has issue of missing both modules in dependencies below, whereas Android only has issue of midding "react-native-svg")
    npm i @fluentui/react-native
  4. Observe:
    4.1. add a TextV1 component to App.js -- "use-subscription" module is missing
    Observe that "use-subscription" is in devDependencies: https://github.com/microsoft/fluentui-react-native/blob/main/packages/experimental/NativeFontMetrics/package.json
    image
    4.2 add a CheckboxV1 component to App.js -- "react-native-svg" is missing
    Observe that "react-native-svg" is in devDependencies: https://github.com/microsoft/fluentui-react-native/blob/main/packages/components/Checkbox/package.json
    image

"use-subscription" is used in Text and "react-native-svg" is used in many other packages/components. They are the two that are found to be not in dependencies when they should, but there could be other modules having the same issue.

Actual behavior

Some NPM modules are missing after installing Fluent UI React Native via npm i @fluentui/react-native
It takes extra manual steps to install the modules to dependencies.

Expected behavior

It shouldn't take extra manual step to install the missing modules after installing Fluent UI React Native.

In other words, if the modules are needed, they should be in dependencies (if they are intended to be non-shared dependencies) or peerDependencies (if they are intended to be shared dependencies) instead of devDependencies (which are not available at runtime).

@Saadnajmi
Copy link
Collaborator

For react-native-svg, the React Native CLI doesn't support auto linking transitive dependencies. Because of that, the end app generally has to also add packages with native modules as a direct dependency. If we add react-native-svg as a direct dependency, and the end app has a different version of react-native-svg, then you could run into issues with multiple versions of react-native-svg (and it's native modules) present in node_modules. I think for that reason we kept react-native-svg as a peerDependency. However, if that's causing issues, it might be good to revisit that decision.

For use-subscription I remember there was something weird about the versioning of that package but I can't remember what.

chrisglein added a commit to chrisglein/artificial-chat that referenced this issue Mar 31, 2023
- Allows use of their Button type
- Required importing SVG (see microsoft/fluentui-react-native#2613)
- Which in turn requires importing the Win2D nuget
- Also required switching to classic runtime (see microsoft/fluentui-react-native#1891)
chrisglein added a commit to chrisglein/artificial-chat that referenced this issue Mar 14, 2024
- Allows use of their Button type
- Required importing SVG (see microsoft/fluentui-react-native#2613)
- Which in turn requires importing the Win2D nuget
- Also required switching to classic runtime (see microsoft/fluentui-react-native#1891)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants