fix: omit @strapi devDependencies for local plugins - #202
singhlovepreet9 wants to merge 1 commit into
Conversation
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
|
The problem this targets is real (a 1.6 GB
|



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.