question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom postcss plugins won't work in production build

See original GitHub issue

Hey,

I am trying to use postcss with tailwindcss plugin. It works for ng serve and ng build but when using ng build --prod to build production assets, it doesnt run tailwindcss plugin. I added console log at start of custom webpack file, it shows in console but it just doesnt run tailwindcss plugin.

My custom webpack looks like this:

const tailwindcss = require('tailwindcss');

console.log('** Custom webpack config was loaded.');

module.exports = {
    module: {
        rules: [
            {
                test: /\.css$/,
                use: [
                    {
                        "loader": "postcss-loader",
                        "options": {
                            "ident": "embedded",
                            "plugins": [
                                tailwindcss('./tailwind.js'),
                            ],
                            "sourceMap": true
                        }
                    }
                ]
            },
        ],
    },
};

I have tried all mergeStrategies in angular.json configuration but it doesnt work anyway.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
just-jebcommented, Sep 18, 2018

Ok, need to take a look at Angular internals. Probably they are disabling postcss plugin in production build or something.

0reactions
mihaliakcommented, Dec 5, 2018

Setting extractCss to false in angular.json file fixed this issue, extra webpack config is loaded and build is ok.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced Features: Customizing PostCSS Config - Next.js
Extend the PostCSS config and plugins added by Next.js with your own. ... To customize the PostCSS configuration, create a postcss.config.json file in...
Read more >
[object Object] is not a PostCSS plugin. This happened when i ...
The app runs perfectly on the development. But when I tried to build it on production it shows me this error. I never...
Read more >
PostCSS Plugin Guidelines
A PostCSS plugin is a function that receives and, usually, transforms a CSS AST from the PostCSS parser. The rules below are mandatory...
Read more >
postcss/postcss - Gitter
Hi all I'm getting this error while using postcss-loader. ERROR in ./node_modules/ag-grid-community/dist/styles/ag-theme-fresh.css Module build failed (from ...
Read more >
CSS - Parcel
If this was the only PostCSS plugin you used, you can remove your PostCSS config entirely. This can improve build performance significantly. You...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found