histoire: use of histoire in nuxt3 returns vite "could not resolve" errors
Describe the bug
after setting up histoire in nuxt3 and running histoire dev, vite returns a couple of could not resolve errors
it also happens on the nuxt3 StackBlitz demo on the histoire docs
Reproduction
https://stackblitz.com/edit/histoire-nuxt3-starter
System Info
System:
OS: macOS 12.5.1
CPU: (4) x64 Intel(R) Core(TM) i5-5287U CPU @ 2.90GHz
Memory: 1.64 GB / 8.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.13.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.1.0 - /usr/local/bin/npm
Browsers:
Chrome: 105.0.5195.125
Firefox: 103.0.2
Safari: 15.6.1
npmPackages:
@histoire/plugin-nuxt: ^0.10.7 => 0.10.7
@histoire/plugin-vue: ^0.10.7 => 0.10.7
histoire: ^0.10.7 => 0.10.7
vite: ^3.0.9 => 3.1.3
Used Package Manager
yarn
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 4
- Comments: 24 (7 by maintainers)
Thanks @Akryum for working on improving nuxt support!
We also still get problems. So far we observed two:
error 1: __HST_COLLECT__ is not defined
error 2: ERR_PACKAGE_IMPORT_NOT_DEFINED
nuxi info output
its still a problem I guess: https://stackblitz.com/edit/histoire-nuxt3-starter-u4prm7?file=nuxt.config.ts,package.json
Yup looks like the issue is still here 😐
Starter with latest Nuxt works again with Histoire 0.17.3 https://stackblitz.com/edit/histoire-nuxt3-starter?file=package.json
I had an identical problem, if you use
nuxt/tailwindcss+histoireand somehow your stories are included in the component directory or any other path that tailwind will look into to figure out which classes to purge you end up with this error.In my case I had a story that used logEvent from
histoire/clientand that story ended up to be included in one of the paths tailwind inspected to index all none-purgeable classes via content directory array.What solved my problem was to move all *.story.vue components out of the composable, pages, layout directories and put them into a extra story directory
Repo showing the failure: https://stackblitz.com/edit/histoire-nuxt3-starter-wkzb2w This is working afaik: https://stackblitz.com/edit/histoire-nuxt3-starter-vd7d7z
If I’m correct it has something to do with this issue: https://github.com/tailwindlabs/tailwindcss/issues/8828
I tried to solve it by excluding all stories from the list of classes that tailwind will load and inspect. Like so:
But that did not work for me.
I confirm after upgrade to NUXT RC11 i’ve got the same error
Encountering this as well on Nuxt3@rc.11 with the same histoire packages.
Another error using nuxt 3.0.0-rc.13
reproduction template: -> https://stackblitz.com/edit/histoire-nuxt3-starter-vyrldb
getting similar thing with axios… any ideas where to dig for the cause?
Seems to occur when there are any imports from
histoire/client.