Mocking internal module does not work via "Builder aliases" #29260
Replies: 2 comments
-
|
Getting the exact same problem (I think) in #31207 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
In Storybook 10.1, we have introduced module mocking: Aliasing module, therefore, isn't required anymore, but the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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:testModuleis 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
testModulecalled, indicating that the mock is not being applied.Additional Information
Storybook version:
^8.3.4Vite version:
^5.2.9Vue version:
^3.4.15Node.js version:
18.19.0Operating System:
MacOS Sequoia 15.0Possible 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