strapi / sdk-plugin

CLI toolkit for developing a Strapi plugin
Other
4 stars 4 forks source link

Creating a new plugin with `plugin:init` will create a line in `files` which does not work with `yalc #2

Closed Alexnortung closed 1 month ago

Alexnortung commented 4 months ago

Bug report

Required System information

Describe the bug

I followed the guide for setting up a new plugin with the experimental strapi plugin:init command. I was unable to use the server part of the plugin in an external strapi project. It turned out that yalc was unable to use ./strapi-server.js.

https://github.com/strapi/strapi/blob/a76a2ee7a9a66bc0233e678ca062086c34855a5c/packages/core/strapi/src/commands/actions/plugin/init/action.ts#L340

SOLUTION: Simply changing this value in the package.json file to "strapi-server.js" resolved the issue

Steps to reproduce the behavior

  1. Create a new plugin wiht plugin:init
  2. use it in an external project with the yalc command from the logs.
  3. See that the strapi-server.js file is not present in the node_modules and that the server part is not loaded at all.

Expected behavior

I expected that the output of the plugin:init command would just work without having to change anything in package.lock.

innerdvations commented 1 month ago

This is fixed in this repo for Strapi 5 plugins, and it also appears to be fixed in strapi/strapi develop branch for Strapi 4 plugins as well, so I'll close this and if the issue is still present on strapi/strapi an issue can be recreated there.