Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bemayr opened this issue Feb 1, 2024 · 3 comments
Assignees

Comments

@bemayr
Copy link

bemayr commented Feb 1, 2024

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):

  • OS: macOS Sonoma 14.1.1 on Macbook Air 2020 M1
  • Node: 21.5.0
  • pnpm: 8.14.0
  • @storyblok/field-plugin: 1.0.1

Additional context
I did a bit of debugging into

const copyHelpersToRootDist = async () => {
const cwd = path.resolve(__dirname)
for (const mod of SUBMODULES) {
await execaCommand(`cd ../dist && mkdir -p ${mod}`, { cwd, shell: true })
await execaCommand(`cp ./dist/${mod}/src/* ../dist/${mod}/`, {
cwd,
shell: true,
})
}
and still wonder what's the difference between the test-package and the others?

@BibiSebi
Copy link
Contributor

BibiSebi commented Feb 1, 2024

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

@BibiSebi
Copy link
Contributor

BibiSebi commented Feb 8, 2024

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
Copy link
Author

bemayr commented Feb 9, 2024

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.

@bemayr bemayr closed this as completed Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants