Building strapi plugins in a monorepo Strapi 5

I’m not sure if I’m building my plugins the right way, but I added this to my package.json scripts in strapi 4:
"prebuild": "cd src/plugins/plugin-1 && npm install && npm run build && cd ../plugin-2 && npm install && npm run build"
This apporoach doesn’t work in strapi 5 since the plugin build scripts expects to have the strapi-plugin command available.
"build": "strapi-plugin build"
Because the @strapi/sdk-plugin dependency is in the devDependencies by default, the strapi-plugin command is not defined when installing the packages without the devDependencies npm install --omit=dev.

Is there a better approach to build the plugins instead of my current prebuild command? And how to prevent moving the @strapi/sdk-plugin to the normal dependencies of each plugin so the strapi-plugin command is available?

This topic has been created from a Discord post (1298960520363376740) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

:raising_hand_man: Having the same issue, didn’t figure out a solution yet

<@1298951736681041980> i was using prebuild option for local development, but when I try to deploy its exits with error.