Skip to content

Replace legacy-peer-deps with targeted override#554

Merged
cigamit merged 1 commit into
ctrliq:mainfrom
blaipr:fix/replace-legacy-peer-deps
Jun 29, 2026
Merged

Replace legacy-peer-deps with targeted override#554
cigamit merged 1 commit into
ctrliq:mainfrom
blaipr:fix/replace-legacy-peer-deps

Conversation

@blaipr

@blaipr blaipr commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Removes legacy-peer-deps = true from .npmrc, which was causing npm to pull in duplicate dependency trees (2100 packages, 1945 after dedup)
  • Adds a targeted overrides entry in package.json for babel-plugin-styled-components to accept the installed @babel/core version, since the plugin works fine with Babel 8 via the jsx-compat wrapper
  • Regenerates package-lock.json with strict peer dep resolution: 1800 packages (down from 2100)

Context

PR #553 added legacy-peer-deps to fix the npm install failure from the Babel 8 peer dep conflict. As cigamit noted, that flag changed npm's entire resolution strategy, inflating the dependency count by ~400 packages. This PR fixes the same peer dep conflict surgically, without the side effects.

Test plan

  • rm -rf node_modules && npm install succeeds without errors
  • npm start compiles without errors
  • npm test passes

Remove the blanket legacy-peer-deps setting from .npmrc. Instead,
add a package.json override for babel-plugin-styled-components to
accept the installed @babel/core version. This resolves the Babel 8
peer dep conflict without changing npm's resolution strategy for every
other package, keeping the dependency tree lean (1804 vs 2100).
@blaipr blaipr force-pushed the fix/replace-legacy-peer-deps branch from 214cb35 to eff95fa Compare June 29, 2026 05:51
@cigamit

cigamit commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Can you add this to the override, and it should suppress the other 15 warnings.

Example warning:

npm warn ERESOLVE overriding peer dependency
npm warn While resolving: @babel/plugin-syntax-top-level-await@7.14.5
npm warn Found: @babel/core@8.0.1
npm warn node_modules/@babel/core
npm warn   dev @babel/core@"^8.0.1" from the root project
npm warn   82 more (@babel/eslint-parser, @babel/eslint-plugin, ...)
npm warn
npm warn Could not resolve dependency:
npm warn peer @babel/core@"^7.0.0-0" from @babel/plugin-syntax-top-level-await@7.14.5
npm warn node_modules/babel-preset-current-node-syntax/node_modules/@babel/plugin-syntax-top-level-await
npm warn   @babel/plugin-syntax-top-level-await@"^7.14.5" from babel-preset-current-node-syntax@1.2.0
npm warn   node_modules/babel-preset-current-node-syntax
npm warn
npm warn Conflicting peer dependency: @babel/core@7.29.7
npm warn node_modules/@babel/core
npm warn   peer @babel/core@"^7.0.0-0" from @babel/plugin-syntax-top-level-await@7.14.5
npm warn   node_modules/babel-preset-current-node-syntax/node_modules/@babel/plugin-syntax-top-level-await
npm warn     @babel/plugin-syntax-top-level-await@"^7.14.5" from babel-preset-current-node-syntax@1.2.0
npm warn     node_modules/babel-preset-current-node-syntax

add this to the override

    "@babel/plugin-syntax-async-generators": {
      "@babel/core": "$@babel/core"
    },
    "@babel/plugin-syntax-bigint": {
      "@babel/core": "$@babel/core"
    },
    "@babel/plugin-syntax-class-properties": {
      "@babel/core": "$@babel/core"
    },
    "@babel/plugin-syntax-class-static-block": {
      "@babel/core": "$@babel/core"
    },
    "@babel/plugin-syntax-import-attributes": {
      "@babel/core": "$@babel/core"
    },
    "@babel/plugin-syntax-import-meta": {
      "@babel/core": "$@babel/core"
    },
    "@babel/plugin-syntax-json-strings": {
      "@babel/core": "$@babel/core"
    },
    "@babel/plugin-syntax-logical-assignment-operators": {
      "@babel/core": "$@babel/core"
    },
    "@babel/plugin-syntax-nullish-coalescing-operator": {
      "@babel/core": "$@babel/core"
    },
    "@babel/plugin-syntax-numeric-separator": {
      "@babel/core": "$@babel/core"
    },
    "@babel/plugin-syntax-object-rest-spread": {
      "@babel/core": "$@babel/core"
    },
    "@babel/plugin-syntax-optional-catch-binding": {
      "@babel/core": "$@babel/core"
    },
    "@babel/plugin-syntax-optional-chaining": {
      "@babel/core": "$@babel/core"
    },
    "@babel/plugin-syntax-private-property-in-object": {
      "@babel/core": "$@babel/core"
    },
    "@babel/plugin-syntax-top-level-await": {
      "@babel/core": "$@babel/core"
    }

@cigamit cigamit self-assigned this Jun 29, 2026

@cigamit cigamit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add the other overrides in my own PR.

@cigamit cigamit merged commit c19790b into ctrliq:main Jun 29, 2026
@blaipr

blaipr commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

I'll add the other overrides in my own PR.

ok!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants