Skip to content

Troubleshooting the Storybook addon

Internal server error: Failed to resolve import “pathe”

This is likely a compatibility issue with pnpm and vite in monorepo.

To work around this, you can add shamefully-hoist to your .npmrc:

.npmrc
shamefully-hoist=true

or hoist the pathe package:

.npmrc
hoist-pattern[] = pathe

It takes empty snapshots on Vitest tests

If you are using Storybook 8.5 and using the workaround to run both stories and tests as described here, Storybook are also transforming the tests as if they are stories. That causes it to inject elements into the DOM and this addon detect that as some rendering by your tests, thus taking an image snapshot.

Since it is a bug to be addressed soon, please disable the snapshots for your tests by adding a beforeAll hook:

import { setAutoSnapshotOptions } from 'storybook-addon-vis'
import { beforeAll } from 'vitest'
beforeAll(() => setAutoSnapshotOptions(false))