Skip to content

npm run build "PurgeCSS is not enabled because you are in dev mode" #52

@poldixd

Description

@poldixd

I created a nuxt app with npx create-nuxt-app <project-name>. I choosed tailwind as the css framework. Here is my default nuxt.config.js


export default {
  mode: 'universal',
  /*
  ** Headers of the page
  */
  head: {
    title: process.env.npm_package_name || '',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },
  /*
  ** Customize the progress-bar color
  */
  loading: { color: '#fff' },
  /*
  ** Global CSS
  */
  css: [
  ],
  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
  ],
  /*
  ** Nuxt.js dev-modules
  */
  buildModules: [
    // Doc: https://github.com/nuxt-community/nuxt-tailwindcss
    '@nuxtjs/tailwindcss',
  ],
  /*
  ** Nuxt.js modules
  */
  modules: [
    // Doc: https://axios.nuxtjs.org/usage
    '@nuxtjs/axios',
  ],
  /*
  ** Axios module configuration
  ** See https://axios.nuxtjs.org/options
  */
  axios: {
  },
  /*
  ** Build configuration
  */
  build: {
    /*
    ** You can extend webpack config here
    */
    extend (config, ctx) {
    }
  }
}

If I used npm run build the console output shows PurgeCSS is not enabled because you are in dev mode.

Next I added cross-env to the project and added the cross-env command to the package.json:

  "scripts": {
    "dev": "nuxt",
    "build": "cross-env NODE_ENV=production nuxt build",
    "start": "nuxt start",
    "generate": "nuxt generate"
  },

If I run npm run build the console shows the same output PurgeCSS is not enabled because you are in dev mode.

> cross-env NODE_ENV=production nuxt build

i Production build                                                                                                                                                          13:23:20  
start Loading module                                                                                                                                          nuxt-purgecss 13:23:20  
i PurgeCSS is not enabled because you are in dev mode                                                                                                         nuxt-purgecss 13:23:20  
√ Builder initialized                                                                                                                                                       13:23:20  
√ Nuxt files generated   

Same issue, when I added this to nuxt.config.js:

    purgeCSS: {
        enabled: true
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions