Mocking internal module does not work via "Builder aliases" #29260
Unanswered
unixhelloworld
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
I encountered an issue where trying to mock an internal module using alias in the Vite configuration for Storybook does not work. Even though the path to the mock is correctly specified and Storybook compiles without issues, the original module is called instead of the mock.
Additional information
.storybook/mocks/test.ts
:testModule
is called instead of the mocked version.Expected Behavior
The mocked version of the module defined through the alias in the Vite configuration should be used instead of the original one.
Actual Behavior
The original version of the module is used instead. The console does not log Mocked
testModule
called, indicating that the mock is not being applied.Additional Information
Storybook version:
^8.3.4
Vite version:
^5.2.9
Vue version:
^3.4.15
Node.js version:
18.19.0
Operating System:
MacOS Sequoia 15.0
Possible Causes and Solutions
The issue might be related to Vite not applying the alias for internal modules properly in Storybook.
I’ve tried restarting Storybook, clearing the cache, but the issue persists.
No response
Beta Was this translation helpful? Give feedback.
All reactions