I am facing an issue with experimental class decorators in my code, causing the Storybook build to crash.
Module build failed (from ./node_modules/@storybook/nextjs/dist/swc/next-swc-loader-patch.js):
Error:
× Expression expected
Despite reading the confusing SWC documentation in the Storybook docs, I am using Storybook 8 with the "@storybook/nextjs" framework. Upon launching Storybook, the console message shows "info => Using SWC as compiler", even though SWC is not supposed to be enabled by default, and I have not enabled it in the configuration. Why is SWC being used?
Following the SWC and Storybook docs, I have added the following code to my Storybook main.ts file:
const config: StorybookConfig = {
...
swc: (config: Options, options): Options => {
return {
...config,
jsc: {
parser: {
decorators: true
}
}
};
},
}
However, the code above is not being executed. I could throw an exception there, but it is not being thrown.
How can I enable decorator support with Storybook 8 and NextJs?