0

I’m passing a valid PostCSS plugin to StencilJS in the usual way via the PostCSS configuration, and I get an unexpected error message at runtime:

Build Error: @tailwindcss/postcss is not a PostCSS plugin at Processor.normalize ...

stencil.config.ts

import { Config } from '@stencil/core';
import { postcss } from '@stencil-community/postcss';

export const config: Config = {
  plugins: [
    postcss({
      plugins: [
        '@tailwindcss/postcss': {},
      ],
    })
  ]
};

1 Answer 1

1

Yes, StencilJS by itself is not capable of interpreting PostCSS. A community plugin, @stencil-community/postcss, enables this. Since it’s a third-party plugin, it may behave differently from the official PostCSS configuration. As it hasn't been actively updated for two years, similar unexpected errors can be expected. The solution is to import the PostCSS plugins as JS and then pass the result by running them as JS functions:

stencil.config.ts

import { Config } from '@stencil/core';
import { postcss } from '@stencil-community/postcss';
import tailwindcss from '@tailwindcss/postcss';

export const config: Config = {
  plugins: [
    postcss({
      plugins: [
        tailwindcss(),
      ],
    })
  ]
};

Reference:

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

Comments

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.