I'm using gatsby-plugin-alias-imports
to be able to do absolute imports like so: import { colors } from "@styles/theme";
This is set up in the gatsby-config
. Now I've just added storybook to my project. Since storybook doesn't run through gatsby, the alias imports won't resolve and I get an error:
ERROR in ./src/components/Button/index.js Module not found: Error: Can't resolve '@styles/theme' in ...
This makes sense. Storybook doesn't know what to do with @styles...
- but how can I fix this?
@styles
points to? Also,@styles
might not point tosrc/styles
but to a completely different path? Or am I misunderstanding your answer here? – Humidor