styled-components / babel-plugin-styled-components

Improve the debugging experience and add server-side rendering support to styled-components
MIT License
1.07k stars 139 forks source link

Missing peerDependencies on babel-plugin-styled-components #400

Open NogrTL opened 11 months ago

NogrTL commented 11 months ago

Duplicate of https://github.com/styled-components/styled-components/issues/4179

Environment

npx envinfo --system --binaries --npmPackages styled-components,babel-plugin-styled-components --markdown

System:

Reproduction

Setup styled-components with Webpack + Babel + babel-plugin-styled-components Example here -> https://github.com/NogrTL/Babel-styled-componenets

Steps to reproduce

  1. Run yarn install
  2. Watch

Expected Behavior

No warnings peer dependencies are incorrectly met

Actual Behavior

Got warning babel-plugin-styled-components@npm:2.1.4 [33f51] doesn't provide @babel/core (p86bed), requested by @babel/plugin-syntax-jsx

If this article to be believed you're missing peerDependencies:@babel/core in babel-plugin-styled-components and styled-components https://yarnpkg.com/advanced/error-codes#yn0002---missing_peer_dependency

In confirmation of that - adding this overwrite to .yarnrc.yml solves the issue

packageExtensions:
  "babel-plugin-styled-components@*":
    peerDependencies:
      "@babel/core": "^7.0.0-0"
  "styled-components@*":
    peerDependencies:
      "@babel/core": "^7.0.0-0"