Home > Software engineering >  Nuxt "yarn dev" build loop after setting up "@nuxtjs/tailwindcss": "^5.0.2&
Nuxt "yarn dev" build loop after setting up "@nuxtjs/tailwindcss": "^5.0.2&

Time:04-12

When I use @apply in my style tag like that:

<style lang="postcss" scoped>
input {
  @apply absolute right-0 top-0 opacity-0 z-10;
}
</style> 

It generate a loop/reload: loop

these are my dependencies:

"dependencies": {
    "@nuxtjs/axios": "^5.13.6",
    "core-js": "^3.19.3",
    "nuxt": "^2.15.8",
    "vue": "^2.6.14",
    "vue-server-renderer": "^2.6.14",
    "vue-template-compiler": "^2.6.14",
    "webpack": "^4.46.0"
  },
  "devDependencies": {
    "@babel/eslint-parser": "^7.16.3",
    "@nuxtjs/eslint-config": "^8.0.0",
    "@nuxtjs/eslint-module": "^3.0.2",
    "@nuxtjs/svg": "^0.4.0",
    "@nuxtjs/tailwindcss": "^5.0.2",
    "eslint": "^8.4.1",
    "eslint-plugin-nuxt": "^3.1.0",
    "eslint-plugin-vue": "^8.2.0",
    "postcss": "^8.4.4"
  }

This is my eslint config:

module.exports = {
  root: true,
  env: {
    browser: true,
    node: true
  },
  parserOptions: {
    parser: '@babel/eslint-parser',
    requireConfigFile: false
  },
  extends: [
    '@nuxtjs',
    'plugin:nuxt/recommended'
  ],
  plugins: [
  ],
  // add your custom rules here
  rules: {}
}

this is my nuxt config:

 // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
    // https://go.nuxtjs.dev/eslint
    '@nuxtjs/eslint-module',
    // https://go.nuxtjs.dev/tailwindcss
    '@nuxtjs/tailwindcss',
    '@nuxtjs/svg'
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios'
  ],

  // Axios module configuration: https://go.nuxtjs.dev/config-axios
  axios: {
    // Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
    baseURL: '/'
  },

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
  },

  server: {
    port: 9000, // default: 3000
    host: '0.0.0.0'
  }

they were discussing in this issue the problem https://github.com/nuxt-community/tailwindcss-module/issues/359 but that solutions are not working for me :( any help?

CodePudding user response:

I got a fix from the answers i got on the issue ;)

One temporary fix can be to add this in the nuxt.config.js

watchers: {
    webpack: {
      ignored: [
        '**/*.eslintcache',
        '**/.git/**'
      ]
    }
  },
  • Related