histoire
histoire copied to clipboard
chore(deps): upgrade vite & nuxt dependencies
Description
We're currently migrating a monorepo from nx to pnpm workspaces, and histoire dev is failing with:
Error while collecting story [foo].story.vue:
Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '[foo]' is not supported resolving ES modules imported from [foo]
ERR_UNSUPPORTED_DIR_IMPORT issues are mentioned in https://github.com/histoire-dev/histoire/issues/712 and https://github.com/histoire-dev/histoire/issues/696 with workarounds of either pinning mlly to 1.4.2, or using viteNodeInlineDeps for problematic packages.
This PR bumps vite, vite-node, and nuxt packages, and adds a small fix to isCollecting as tsc was failing on PluginContextMeta.
Tests are passing, build is building, and histoire dev is running successfully.
Edit: looks like previews are failing with a node and pnpm version mismatch in the root package.json, assume the answer is bumping the node version in engines, but will hold off on that.
Just in case this helps anyone, this is working in the meantime:
"pnpm": {
"overrides": {
"histoire>vite-node": "2.0.5",
"histoire>vite": "5.4.3",
"histoire>vitest": "2.0.5",
"@histoire/plugin-nuxt>nuxt": "^3.12.4",
"@histoire/plugin-nuxt>vite": "5.4.3",
"@histoire/plugin-nuxt>@nuxt/kit": "^3.12.4",
"@histoire/plugin-nuxt>@nuxt/schema": "^3.12.4",
"@histoire/plugin-vue>vite": "5.4.3"
}
}
What is the purpose of this pull request?
- [x] Bug fix
- [ ] New Feature
- [ ] Documentation update
- [ ] Other
Run & review this pull request in StackBlitz Codeflow.
Deploy Preview for histoire-examples-vue3 failed.
| Name | Link |
|---|---|
| Latest commit | 3a44baf4adacc11c0cd85e663a43dc3e8e02971f |
| Latest deploy log | https://app.netlify.com/sites/histoire-examples-vue3/deploys/66dcaa0adc412d0008a295bf |
Deploy Preview for histoire-controls failed.
| Name | Link |
|---|---|
| Latest commit | 3a44baf4adacc11c0cd85e663a43dc3e8e02971f |
| Latest deploy log | https://app.netlify.com/sites/histoire-controls/deploys/66dcaa0a37a5e10008172ca7 |
Deploy Preview for histoire-examples-svelte3 failed.
| Name | Link |
|---|---|
| Latest commit | 3a44baf4adacc11c0cd85e663a43dc3e8e02971f |
| Latest deploy log | https://app.netlify.com/sites/histoire-examples-svelte3/deploys/66dcaa0af5f8e600080e5f85 |
Deploy Preview for histoire-site failed.
| Name | Link |
|---|---|
| Latest commit | 3a44baf4adacc11c0cd85e663a43dc3e8e02971f |
| Latest deploy log | https://app.netlify.com/sites/histoire-site/deploys/66dcaa0a14dbfc00080056c1 |
When I apply the overrides I get another, but different error (see below)
Error while collecting story /src/components/button/Base.story.vue:
TypeError [ERR_PACKAGE_IMPORT_NOT_DEFINED]: Package import specifier "#build/nuxt.config.mjs" is not defined in package /src/node_modules/nuxt/package.json imported from /src/node_modules/nuxt/dist/app/nuxt.js
at importNotDefined (node:internal/modules/esm/resolve:291:10)
at packageImportsResolve (node:internal/modules/esm/resolve:741:9)
at moduleResolve (node:internal/modules/esm/resolve:917:16)
at defaultResolve (node:internal/modules/esm/resolve:1169:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:540:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:509:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:239:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:96:40)
at link (node:internal/modules/esm/module_job:95:36)
I use npm so the below the overrides in npm style (did bump the nuxt verion, however error occurs also in version you mention):
"overrides": {
"histoire": {
"vite-node": "2.0.5",
"vite": "5.4.3",
"vitest": "2.0.5"
},
"@histoire/plugin-nuxt": {
"nuxt": "^3.13.1",
"vite": "5.4.3",
"@nuxt/kit": "^3.13.1",
"@nuxt/schema": "^3.13.1"
},
"@histoire/plugin-vue": {
"vite": "5.4.3"
}
}
Checks seem to be failing due to node version missmatch. Vite 5 requires node 18 or 20+: https://vite.dev/guide/migration#node-js-support