2

I have the following postccs.config.js file:

module.exports = {
    plugins: [
        require("postcss-import"),
        require("tailwindcss"),
        require("autoprefixer"),
    ],
}

which allows me to run tailwind and storybook together, however when I try to run my application, I get this error:

Error: A PostCSS Plugin was passed as a function using require(), but it must be provided as a string.

Is there a way to provide a specific storybook postcss config or even a better way for the 2 to work with the same config?

enter image description here

1 Answer 1

3

you need to execute the require. Your config should look like this:

module.exports = {
  plugins: [
    require('postcss-import')(),
    require('tailwindcss')('./tailwind.config.js'), //This refers to your tailwind config
    require('autoprefixer'),
  ],
};

also this was answered before @see: How to configure VueJS + PostCss + Tailwind with Storybook

Sign up to request clarification or add additional context in comments.

2 Comments

It doesn't solve the issue, storybook runs fine but the not the application.
Do you still get the same Error ? 🤔

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.