compilerOptions/jsxImportSource
not parsed by nextjs framework
#25175
-
SummaryI'm working on creation of a Design System based on universal React Native components. I'm using NativeWind (V4) to style my components in the Tailwind CSS way. It's ok and it's work really well in an Next JS app (using next/expo-adapter) and in an Expo app. I tried to create a Storybook app to preview my components. Init has been done using storybook nextjs framework with the following config in
NativeWind V4 requires the following configuration to get it works :
I tried two things :
It doesn't work at all. So I decided to go inside the I created a patch and It's work but I think it's very ugly. I added this in loader.ts : swcCacheDir: path.join(dir, nextConfig?.distDir ?? '.next', 'cache', 'swc'),
bundleTarget: 'default',
+ swc: await options.presets.apply("swc", {}, options) And this in next-swc-loader-patch.ts : swcCacheDir,
serverComponents,
isReactServerLayer,
+ swc
} = loaderOptions;
...
const programmaticOptions = {
...swcOptions,
+ ...swc,
filename, I need help to try to understand if there is a bug in Storybook or if I made mistakes in my config. Additional informationNo response Create a reproductionNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hi @rmarquois Thank you for opening this discussion. Custom swc options are indeed currently not passed in into the Next.js loader. Can you point me to the Next.js documentation where you can pass in custom SWC options to Next.js? I am bit confused, because I can't find your recommended settings on https://docs.expo.dev/guides/using-nextjs/. Does the expo adapter configure everything under the hood? Could you give me some further context? |
Beta Was this translation helpful? Give feedback.
-
Hi @valentinpalkovic and thank for your response. Actually I need to set Configuration works in a isolated Next.js project but not with Storybook. While browsing the Storybook documentation, I saw that we can force SWC compilation and set a custom config (see here). I thought that it was the only way to put my NativeWind config but maybe I'm wrong. |
Beta Was this translation helpful? Give feedback.
I have created a PR to fix this! #25203