Storybook Vite — Component with separate styles in a links
function does not get surfaced in Storybook
#9203
Unanswered
thomasverleye
asked this question in
Q&A
Replies: 3 comments
-
Setup configvite.config.tsimport { vitePlugin as remix } from '@remix-run/dev';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import { flatRoutes } from 'remix-flat-routes';
const isStorybook = process.argv[1]?.includes('storybook');
export default defineConfig({
build: {
sourcemap: true,
},
ssr: {
noExternal: ['remix-i18next'],
},
plugins: [
!isStorybook &&
remix({
ignoredRouteFiles: ['**/*'],
serverModuleFormat: 'esm',
routes(defineRoutes) {
return flatRoutes('routes', defineRoutes, {
ignoredRouteFiles: ['**/*.test.{js,jsx,ts,tsx}', '**/__*.*', '**/*.stories.tsx'],
});
},
}),
tsconfigPaths(),
],
}); storybook
|
Beta Was this translation helpful? Give feedback.
0 replies
-
@markdalgleish or @pcattori did anyone of you had the time to look into this issue? :-) |
Beta Was this translation helpful? Give feedback.
0 replies
-
FWIW: I've created a component component
Usage in storybook story:
|
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.
-
Introduction
In our setup we're using Storybook's
react-vite
framework to render our components.We're already setting up our vite config as suggested in the Remix documentation.
Problem
We are loading our css as an explicit URL import (
?url
) for it to work in remix, eg:When looking into the network tab we're seeing the following for said css file:
Other findings
When I remove the
styles from
and?url
(import './DiscoverBanner.css';
) the styling correctly loads in Storybook but we'd like to keep make use of the route styles.Question
Could it be that we need to add a certain config that looks for
links
function and automatically loads those imports?I've been digging into the remix vite plugin and do see some transforms but did not take enough time to figure out how they do it.
@markdalgleish or @pcattori any suggestions here? 👀
Beta Was this translation helpful? Give feedback.
All reactions