Developmint / nuxt-purgecss

Drop superfluous CSS! A neat PurgeCSS wrapper for Nuxt.js
MIT License
478 stars 18 forks source link

PurgeCSS is not enabled because you are in dev mode #33

Closed MarvinMiles closed 5 years ago

MarvinMiles commented 5 years ago

Hey! Thanks for your work

Looks like I missed something.

I am using Tailwind CSS and here is my nuxt config:

modules: [ 'nuxt-purgecss' ],

purgeCSS: {
    mode: 'postcss',
    whitelist: ['html', 'body', 'nuxt-progress', 'is-active']
  },

build: {
    extractCSS: true,
    postcss: {
      plugins: {
        tailwindcss: './tailwind.config.js',
        autoprefixer: {}
      }
    }
...

I got "PurgeCSS is not enabled because you are in dev mode" regardless yarn dev or yarn build command I am using

What I am doing wrong? Thanks

manniL commented 5 years ago

Hey 👋

You are welcome! Can you share your whole nuxt.config.js?

PS: When using extractCSS, you could use the default webpack mode :)

MarvinMiles commented 5 years ago

Problem was in "debug: true". Turning it to false solves the issue. Thanks)

desaintflorent commented 5 years ago

I had the same problem. i got the "PurgeCSS is not enabled because you are in dev mode" on my remote app using CleverCloud. Of course I set up DEBUG to true and all env variables to production, but I was always getting an error saying I was in Dev mode.. but I was in production. I think the error message is misleading because it check if (typeof purgeCSS.enabled === 'undefined') but that doesn't mean we are in dev mode right ? I think the problem come from the enabled option with " ({ isDev, isClient }) => (!isDev && isClient) ". It doesn't seem to work anymore. I was getting "undefined" while testing.

For people stuck like me, I ended up setting the enabled option in nuxt.config.js with one of my env variable.

purgeCSS: {
    enabled:  process.env.NODE_ENV == 'production' ? true : false ,
 },
simonhermann commented 4 years ago

I have the same Problem, but even setting enabled: true does not fix it. On Netlify and local, no debug mode or anything set :( Can you help @manniL? 👼

simonhermann commented 4 years ago

I was able to fix the issue by upgrading all dependencies, not sure which one was causing the problem..

Foddie2 commented 10 months ago

After trying all these options still getting the error