Skip to content

Commonly Asked Questions

Cheton Wu edited this page Jun 23, 2023 · 1 revision

FAQ

Yarn creates duplicate dependency resolution with @tonic-ui/react and @tonic-ui/react-lab when using exact versions

From this commit, you can find that @tonic-ui/[email protected] depends on @tonic-ui/react@^1.7.2

https://github.com/trendmicro-frontend/tonic-ui/blob/b76bdc88fb74a9d2f76f701fd830c0910f1473bc/packages/react-lab/package.json

{
  "name": "@tonic-ui/react-lab",
  "version": "0.5.2",
  "dependencies": {
    "@tonic-ui/react": "^1.7.2",
    "@tonic-ui/react-hooks": "^1.4.1",
    "@tonic-ui/utils": "^1.1.2",
    "date-fns": "2.x",
    "ensure-type": "^1.5.1",
    "micro-memoize": "4.x"
  }
}

However, it may cause unexpected results when using exact versions with Yarn.

Use exact version to match dependencies

package.json

{
  "name": "my-app",
  "version": "0.1.0",
  "dependencies": {
    "@tonic-ui/react": "1.7.2",
    "@tonic-ui/react-lab": "0.5.2"
  }
}

yarn install will produce the following results with exact versions

node_modules/@tonic-ui/react-hooks
node_modules/@tonic-ui/utils
node_modules/@tonic-ui/theme
node_modules/@tonic-ui/react // -> 1.7.2
node_modules/@tonic-ui/react/node_modules/react-is
node_modules/@tonic-ui/styled-system
node_modules/@tonic-ui/react-lab // -> 0.5.2
node_modules/@tonic-ui/react-lab/node_modules/react-is
node_modules/@tonic-ui/react-lab/node_modules/@tonic-ui/react // -> 1.8.0 (duplicate)

Use ^version to match dependencies

package.json

{
  "name": "my-app",
  "version": "0.1.0",
  "dependencies": {
    "@tonic-ui/react": "^1.7.2",
    "@tonic-ui/react-lab": "^0.5.2"
  }
}

yarn install will produce the following results:

node_modules/@tonic-ui/react-hooks
node_modules/@tonic-ui/utils
node_modules/@tonic-ui/theme
node_modules/@tonic-ui/react // -> 1.7.2
node_modules/@tonic-ui/react/node_modules/react-is
node_modules/@tonic-ui/styled-system
node_modules/@tonic-ui/react-lab // -> 0.5.2