Skip to content

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

Open
@NogrTL

Description

Duplicate of styled-components/styled-components#4179

Environment

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

System:

  • OS: Windows 10 10.0.22621
  • CPU: (12) x64 AMD Ryzen 5 1600 Six-Core Processor
  • Memory: 3.50 GB / 15.92 GB

Binaries:

  • Node: 16.20.1 - ~\AppData\Local\nvs\default\node.EXE
  • Yarn: 3.6.3 - ~\AppData\Local\nvs\default\yarn.CMD
  • npm: 8.19.4 - ~\AppData\Local\nvs\default\npm.CMD

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"

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions