Material-ui: Can't build with yarn2

Created on 27 Apr 2020  路  6Comments  路  Source: mui-org/material-ui

  • [x] The issue is present in the latest release.
  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 馃槸

When I run yarn start I get:

Failed to compile.

./.yarn/cache/jss-plugin-rule-value-function-npm-10.1.1-f63c97f8af-2.zip/node_modules/jss-plugin-rule-value-function/dist/jss-plugin-rule-value-function.esm.js
Module not found: jss-plugin-rule-value-function tried to access tiny-warning, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Expected Behavior 馃

Steps to Reproduce 馃暪

Steps:

  1. mkdir test
  2. cd test
  3. yarn set version berry
  4. yarn dlx create-react-app my-app --template typescript
  5. cd my-app
  6. yarn add @material-ui/core
  7. add a simple <Button>Test</Button> to App.tsx (with import Button from '@material-ui/core/Button';)
  8. yarn start

Context 馃敠

I'm trying to use yarn2 to get that sweet zero-Installs feature.

Your Environment 馃寧

OS: NixOS unstable

| Tech | Version |
| ----------- | ------- |
| Material-UI | v4.9.12 |
| React | 16.13.1 |
| Browser | Firefox |
| TypeScript | 3.7.2 |
| yarn | 2.0.0-rc.32 |

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react"
  },
  "include": [
    "src"
  ]
}
external dependency styles

Most helpful comment

All 6 comments

@bbigras Please open the issue in JSS, It's an issue on their end. Also, I would be in favor of dropping the dependency on tiny-warning.

I am getting a similar issue on v4.9.12 when react and react-dom are added as a peer dependency in my app (moving them to a normal dependency made the issue disappear):

./.yarn/$$virtual/@material-ui-core-virtual-613969f2c4/0/cache/@material-ui-core-npm-4.9.12-eaaa062c1e-2.zip/node_modules/@material-ui/core/Modal/TrapFocus.js
Module not found: @material-ui/core tried to access react (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

I am getting a similar issue on v4.9.12 when react and react-dom are added as a peer dependency in my app (moving them to a normal dependency made the issue disappear):

peer dependencies of a library need to be added as normal dependencies in your app. This is unrelated to this issue.

If you want to be notified when this issue is fixed watch https://github.com/cssinjs/jss for releases (click "watch" and then "releases only"). More specifically, watch for the next release of jss-plugin-rule-value-function.

JSS v10.2.0 was released, problem solved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FranBran picture FranBran  路  3Comments

ryanflorence picture ryanflorence  路  3Comments

reflog picture reflog  路  3Comments

iamzhouyi picture iamzhouyi  路  3Comments

finaiized picture finaiized  路  3Comments