-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] @storybook/test package not working #92
Comments
@Bronowsm hey, thanks for raising this issue. I have actually seen a similar issue but I'm not familiar with the test package implementation so I'll have to defer to others. Will look into it. |
+1 👀 |
Sorry for the delay! This slipped off my radar but I will make sure to ask around tomorrow. |
so looking back in my chat history with some people the information that I have is that it may have something to do with the CJS of the storybook/test package being messed up and forcing the mjs version could help. Not sure how to do that with webpack yet but leaving this note here for context. |
I think first step would be to create a more minimal reproduction of the problem and then to verify which entrypoint is being used (i.e cjs/mjs) one thing to try is adding to webpack final something like:
to get mjs loading before cjs |
@dannyhw thanks for hints, they were very useful - it was about forcing storybook/test package to use .mjs extension. But overriding config.resolve.extensions didn't do the trick. What I did instead, was to point out to the exact file in node_modules and storybook/test is working again! config.resolve.alias = {
...config.resolve.alias,
'@storybook/test': path.resolve(__dirname, '../node_modules/@storybook/test/dist/index.mjs'),
}; |
Why didn't I think of that!? I moved on with the failure of the extension priority. Anywho, thanks @Bronowsm, works for me! |
Interesting, its so strange that the wrong extension is always getting resolved 😕 . I wonder if theres something wrong with the exports in package.json for the storybook/test package. Or maybe it has something to do with the babel loader that addon-react-native-web is including, not sure |
Found another issue, it appears that the solution @Bronowsm proposed does work for stories, but not when mocking. The underlying implementation of Works: Button.stories.ts
Works: useRouter.mock.ts
Does NOT Work:
|
@JavanPoirier when you use the mock from storybook/test what problem/error do you get? |
Just that it does not exist. Changing the import resolves it. |
@JavanPoirier Does this happen in storybook 8.3? We changed the order of the export condition in 8.3.
|
Looks like I sorted it out, using the Now when using the I kinda liked the ability to not have to add the I am on Example: useRouter.mock.ts
I never needed to import it anywhere or call Now with |
Hey @JavanPoirier that's pretty weird. You should be using |
|
Describe the bug
Whenever I add
@storybook/addon-react-native-web
package to addons array, @storybook/test package stops working.When I comment out or remove @storybook/addon-react-native-web from addons array, the error is gone (screenshot of error below)
Here is my setup:
.storybook/main.js file:
.storybook/preview:
.babelrc
package.json:
webpack.config.js
Screenshots and/or logs
Environment
The text was updated successfully, but these errors were encountered: