storyblok / field-plugin

Create and deploy Storyblok Field Plugin
https://www.storyblok.com/docs/plugins/field-plugins/introduction
25 stars 3 forks source link

Cannot find module '@storyblok/field-plugin/test' or its corresponding type declarations. #343

Closed bemayr closed 6 months ago

bemayr commented 6 months ago

Describe the bug I just bootstrapped a new custom field plug-in. When running pnpm build the task fails, because @storyblok/field-plugin/test could not be found. A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Run pnpm dlx @storyblok/field-plugin-cli@latest create with options pnpm and vue3.
  2. Run pnpm build
  3. The build task crashes with:
src/components/FieldPluginExample/index.spec.ts:4:34 - error TS2307: Cannot find module '@storyblok/field-plugin/test' or its corresponding type declarations.

Expected behavior Bootstrapping an empty custom field works as described in the documentation.

Screenshots I first discovered the problem after following the guide regarding Continuous Delivery: image After doing some debugging I realized that I do not get auto-completion for the test-helpers package at all: image There is also no test folder in the distribution release: image

Desktop (please complete the following information):

Additional context I did a bit of debugging into https://github.com/storyblok/field-plugin/blob/1e8889e7bfa5baae158509601fc9851e7e4a6877/packages/field-plugin/helpers/build.config.ts#L27-L36 and still wonder what's the difference between the test-package and the others?

BibiSebi commented 6 months ago

Hey @bemayr, thank you for the very detailed issue description, our team will investigate this and get back to you.

BibiSebi commented 6 months ago

Hey @bemayr, good news, we fixed the issue. There are two approaches you can take to make the build process work:

  1. pnpm dlx @storyblok/field-plugin-cli@latest create you can run this command to create a new field plugin and everything should work
  2. or feel free to update the field plugin dependency inside your project's package.json to "@storyblok/field-plugin": "1.0.2"

Let me know if you need any more assistance on this :)

bemayr commented 6 months ago

Thanks a lot @BibiSebi! I am glad I could help debugging and the issue was "simply" a missed release. And thanks a lot for explaining the two ways on how to make the build process work, that's a service ;)

The build is working perfectly now, hence I'm closing this issue.