storybookjs / addon-postcss

This Storybook addon can be used to run the PostCSS preprocessor against your stories.
MIT License
20 stars 22 forks source link

[Bug] Angular 11.2.13 and Tailwind 2.1.2 works with start-storybook but not with build-storybook #22

Closed ghidoz closed 3 years ago

ghidoz commented 3 years ago

Describe the bug

When I serve storybook, it shows the Tailwind styles correctly, but if I build it and then serve with http-server, then my components are unstyled.

Steps to reproduce the behavior

  1. Clone the following repo: https://github.com/ghidoz/storybooktest
  2. Run npm install
  3. Serve it with npm run storybook
  4. Check on http://localhost:6006/ that the styles are correclty applied
  5. Built it with npm run build-storybook
  6. Serve it with npx http-server ./storybook/
  7. Check on http://127.0.0.1:8080 that the component is unstyled

Expected behavior

I correctly added the @storybook/addon-postcss to main.js, imported the tailwind css into the preview.js, so I expect to be able to build it and see the styles.

If I check the builded storybook, I can see that main.644e3a31.iframe.bundle.js has the tailwind css, so why is it not working?