You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Strapi 5, local plugins (which are scaffolded inside a project's src/plugins/ directory) end up with a large number of heavy @strapi/ packages in their devDependencies, like @strapi/strapi, @strapi/design-system, and @strapi/icons. Since most Strapi 5 projects do not have root workspace hoisting enabled by default, running an install step inside a local plugin duplicates these heavy dependencies inside src/plugins/my-plugin/node_modules, leading to massive plugin folder sizes (e.g. 1.6 GB).
Root Cause
@strapi/sdk-plugin init indiscriminately populates devDependencies for both standalone and local plugins.
Fix
This PR utilizes the existing isStrapiProject check to omit heavy @strapi/ packages from the generated devDependencies when a plugin is initialized locally inside a Strapi project. The packages correctly remain in peerDependencies so that sdk-plugin build still externalizes them properly during bundling.
Verification
Wrote new unit tests mimicking a local plugin initialization (isStrapiProject = true) and verified devDependencies correctly omits the heavy packages while preserving them in peerDependencies.
pnpm run test:unit passes cleanly.
pnpm run lint passes cleanly.
Fresh-eyes review confirms this strictly targets the root cause with zero risk to standalone plugins.
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b88744ef-5574-4ab3-ad04-f4e7cc8eb7c7
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
🔍 Trigger review
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes strapi/strapi#22946
Problem
In Strapi 5, local plugins (which are scaffolded inside a project's
src/plugins/directory) end up with a large number of heavy@strapi/packages in theirdevDependencies, like@strapi/strapi,@strapi/design-system, and@strapi/icons. Since most Strapi 5 projects do not have root workspace hoisting enabled by default, running an install step inside a local plugin duplicates these heavy dependencies insidesrc/plugins/my-plugin/node_modules, leading to massive plugin folder sizes (e.g. 1.6 GB).Root Cause
@strapi/sdk-plugin initindiscriminately populatesdevDependenciesfor both standalone and local plugins.Fix
This PR utilizes the existing
isStrapiProjectcheck to omit heavy@strapi/packages from the generateddevDependencieswhen a plugin is initialized locally inside a Strapi project. The packages correctly remain inpeerDependenciesso thatsdk-plugin buildstill externalizes them properly during bundling.Verification
isStrapiProject=true) and verifieddevDependenciescorrectly omits the heavy packages while preserving them inpeerDependencies.pnpm run test:unitpasses cleanly.pnpm run lintpasses cleanly.