Closed jonparkdev closed 8 months ago
@jonparkdev did you find any workaround for this
cc @chantastic
@sairaj2119 Not a the moment, it was a blocker for my project so I proceeded without using storybook.
Same thing, I cannot compromise on tailwind so I just ignored storybook
After following the addon-postcss I'm seeing this error too. SB fails to build with CRA TW and SB with this error:
99% done plugins webpack-hot-middlewarewebpack built preview 5f7ac74125465130ad66 in 4135ms
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
SyntaxError
(1:1) /Users/ayemacair/Desktop/code/js/react-ts-tw-sb-01/src/index.css Unknown word
> 1 | var api = require("!../node_modules/@storybook/addon-postcss/node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js");
...
Deps:
Full repro: https://github.com/sshquack/react-ts-tw-sb-01
Any idea on how to get past this issue?
Hey folks. I was able to resolve this in Storybook 6.5.9 and Next 12.1.4 with the following postcss.config.js
, as per this suggestion:
module.exports = {
plugins: [require.resolve('tailwindcss'), require.resolve('autoprefixer')],
};
Hope this is helpful.
In Storybook 7, we did a lot of optimizations regarding Next.js. Just follow the documentation to setup the @storybook/nextjs framework: https://storybook.js.org/docs/8.0/get-started/nextjs. Checkout even the latest prerelease version of Storybook 8 to be up to date: npx storybook@next upgrade
. I am closing this issue. Let us know if you still encounter any issues.
Further notes:
Discussed in https://github.com/storybookjs/storybook/discussions/15961
I am going to assume this is an issue that others may run into when starting a project with these frameworks.
For ease of set, here is demo repo of the result of instructions below:
https://github.com/jonparkdev/storybook-tailwind-nextjs-yarn2