-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Storybook 7 + Nextjs 13 - POSTCSS not being processed in main iframe #22481
Comments
Hi,I solve this problem in my project by import @storybook/addon-styling postcss has been removed in 7.x.And after my test, @storybook/addon-postcss not work well. https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#postcss-removed const config = {
stories: ['../src/**/*.stories.js'],
addons: [
{
name: '@storybook/addon-styling',
options: {
postcss: {
implementation: require('postcss'),
},
},
},
]
} |
Thanks for adding this context @Demi1024 - unfortunately, I don't think this solves the problem when using the I added the config suggestion to a branch on my test repository anyways just to be sure, but the iframe still appears to be loading unprocessed css. 馃檨 |
Hey @mcpatten 馃憢 Not sure exactly why, but converting |
Found workaround (in .storybook/main.ts) webpackFinal: async (config) => {
if (config.module) {
config.module.rules = config.module.rules?.map((rule) => {
if (
rule &&
typeof rule !== 'string' &&
rule.test instanceof RegExp &&
rule.test.test('test.css')
) {
return { ...rule, sideEffects: true };
}
return rule;
});
}
return config;
}, The issue was that webpack was threeshaking css import. Setting |
Or even simpler. If you have |
I came here because I was struggling. Maybe this works for others: /** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
tailwindcss: {},
},
}
export default config Changing it to be a /** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
tailwindcss: {},
},
}
module.exports = config Fixed my issues. |
Describe the bug
Hey 馃憢
I am using the zero-config storybook init script for a nextjs 13 project. I've customized the project's
postcss
options (following these instructions).postcss.config.json
processing rules are respected in global css imported via./storybook/manager.ts
(included inmanager-bundle.css
)However, all css that loads within the main storybook iframe is unprocessed (appears to be loading from the raw source css file).
To Reproduce
I was able to make a minimal repro of this issue using
storybook.new
-> https://stackblitz.com/edit/github-biicxm?preset=nodeI've also posted the minimal code to a personal test repo which you can peruse here. All the changes I've made beyond the default install are encapsulated in this commit.
Hope this helps!
System
Additional context
No response
The text was updated successfully, but these errors were encountered: