histoire-dev / histoire-dev/histoire

Can't resolve dependencies correctly

Open
#738 8 comments 10 reactions 0 assignees View on GitHub
to triage
Dominant language
TypeScript
Stars
3.6k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

When i import `lucide-vue-next`, histoire report it cannot find module:

```
Error while collecting story /Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/demo.story.vue:
Error: Cannot find module /Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/lucide-vue-next@0.397.0_vue@3.4.30/node_modules/lucide-vue-next/dist/esm imported from file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old, file:///Users/zsk/code/github.com/kainstar/reproduce/, file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/_index.js, file:///Users/zsk/code/github.com/kainstar/reproduce/node_modules
at _resolve (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/mlly@1.7.1/node_modules/mlly/dist/index.mjs:2102:19)
at resolveSync (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/mlly@1.7.1/node_modules/mlly/dist/index.mjs:2111:10)
at resolvePathSync (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/mlly@1.7.1/node_modules/mlly/dist/index.mjs:2121:24)
at resolvePath (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/mlly@1.7.1/node_modules/mlly/dist/index.mjs:2125:28)
at isValidNodeImport (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/mlly@1.7.1/node_modules/mlly/dist/index.mjs:2585:30)
at _shouldExternalize (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/vite-node@0.34.7/node_modules/vite-node/dist/server.mjs:78:32)
at shouldExternalize (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/vite-node@0.34.7/node_modules/vite-node/dist/server.mjs:55:19)
at ViteNodeServer.shouldExternalize (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/vite-node@0.34.7/node_modules/vite-node/dist/server.mjs:225:12)
at ViteNodeServer._fetchModule (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/vite-node@0.34.7/node_modules/vite-node/dist/server.mjs:322:36)
at ViteNodeServer.fetchModule (file:///Users/zsk/code/github.com/kainstar/reproduce/histoire-vite-node-too-old/node_modules/.pnpm/vite-node@0.34.7/node_modules/vite-node/dist/server.mjs:261:14)
```

### Reason and solution

After debug, i found it's because histoire using vite-node with a old version 0.34.7 whose latest version is 1.6.0, when i force using vite-node@1.6.0 with pnpm's overrides config, it works.

So is histoire has any play to upgrade vite-node to latest version?

### Reproduction

https://stackblitz.com/edit/histoire-vue3-starter-hzthpp?file=src%2Fdemo.story.vue

### System Info

```shell
System:
OS: macOS 14.4.1
CPU: (8) arm64 Apple M2
Memory: 772.61 MB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.10.0 - ~/Library/Caches/fnm_multishells/18515_1719402069456/bin/node
Yarn: 1.22.19 - ~/Library/Caches/fnm_multishells/18515_1719402069456/bin/yarn
npm: 10.2.3 - ~/Library/Caches/fnm_multishells/18515_1719402069456/bin/npm
pnpm: 8.15.1 - ~/Library/Caches/fnm_multishells/18515_1719402069456/bin/pnpm
Browsers:
Chrome: 126.0.6478.126
Safari: 17.4.1
npmPackages:
@histoire/plugin-vue: ^0.17.17 => 0.17.17
@vitejs/plugin-vue: ^5.0.5 => 5.0.5
histoire: ^0.17.17 => 0.17.17
vite: ^5.3.1 => 5.3.1
```

### Used Package Manager

pnpm

### Validations

- [X] Follow our [Code of Conduct](https://github.com/histoire-dev/histoire/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/histoire-dev/histoire/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://histoire.dev/guide/).
- [X] Check that there isn't [already an issue](https://github.com/histoire-dev/histoire/issues) that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/histoire-dev/histoire/discussions).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and inspect the package dependency that supplies vite-node 0.34.7. Verify whether updating that dependency resolves the lucide-vue-next module error, then run the reproduction with the supported package versions to confirm dependency resolution works.

Written by the indexing model from the issue text.

Assessment

Tech stack
vite
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.