Skip to content
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

Custom webpack loader not working #172

Open
sijakret opened this issue Aug 3, 2021 · 2 comments
Open

Custom webpack loader not working #172

sijakret opened this issue Aug 3, 2021 · 2 comments

Comments

@sijakret
Copy link

sijakret commented Aug 3, 2021

Hey!

If i use a custom webpack loader loader it works in storybook but not in creevy

import {stuff} from '!./myloader!./myfile-to-be-custom-loaded';

in creevy i get this console output

Cannot find module '!./myloader!./myfile-to-be-custom-loaded'

in storybook it works just fine.

Does creevy use the webpack config from storybook?
This case is actually even simpler since i explicitly invoke the loader so this does not even need the webpack config.
I also tried with absolute paths to avoid any issues with that. No success.

Any ideas?
Thank you!

@sijakret
Copy link
Author

sijakret commented Aug 4, 2021

Update:
Also tried with webpack resourceQueries:
Works in storybook dev mode.

but not in creevey

Error: Cannot find module '../src/myfile-to-be-custom-loaded.js?my-loader'

Also, I noticed the same error is produced when doing a static storybook build.
However, the bundling goes through and the bundle works.

are there different webpack stacks used during preview/build/creevey?

Update2:
If remove creevey from the storybook addons config the static storybook build also works so looks like creevey breaks or disrespects the webpack config somehow.

@wKich
Copy link
Collaborator

wKich commented Aug 6, 2021

Hi @sijakret. I'm sorry for the bad experience with Creevey.
For Storybook 6.2+ Creevey uses a different way to load stories metadata through babel by default. It was done to support other bundlers, like Vite. You can try to define useWebpackToExtractTests: true in your Creevey config. This flag forces to use old fashion way to load stories metadata by using webpack, so I hope it should work with custom loaders.

If it doesn't help, I'll suggest to wait a little. Currently, I work on supporting CSFv3 and the new tests format, where no more is needed to load metadata by using babel or webpack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants