Custom webpack loader not working
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!
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.
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.