Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Purge option is causing webpack to not finish #98

Closed
vlados opened this issue Mar 17, 2021 · 6 comments
Closed

Purge option is causing webpack to not finish #98

vlados opened this issue Mar 17, 2021 · 6 comments

Comments

@vlados
Copy link

vlados commented Mar 17, 2021

First of all - great work guys! I am already a fan of tailwindcss and bought the tailwindui and I am loving it.
I switched to jit compiler but it is causing a strange behaviour - webpack compiled successfully, but it's not finishing the process.

Steps to reproduce:

  1. Create a new Laravel 8 project - laravel new tailwindcss
  2. Install all the dependencies - npm install
  3. Install Laravel Mix - npm install laravel-mix --save-dev
  4. Install latest tailwindcss according to the documentation - npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
  5. Initialise tailwindcss - npx tailwindcss init
  6. Build the css to verify that everything is working to this moment - npx tailwindcss init
  7. Configurate tailwind and laravel-mix
  8. Verify that everything is working to this moment - npm run dev
  9. Install tailwindcss/jit and switch to it from postcss options in webpack.config.js - npm install -D @tailwindcss/jit tailwindcss postcss autoprefixer
  10. Build css again
  11. Voala! It's not working - you need to manually kill the process every time and cannot use HOT
module.exports = {
       purge: [],
       purge: [
         './resources/**/*.blade.php',
         './resources/**/*.js',
         './resources/**/*.vue',
       ],
        darkMode: false, // or 'media' or 'class'
        theme: {
          extend: {},
        },
        variants: {
          extend: {},
        },
        plugins: [],
      }
@adamwathan
Copy link
Member

Hey! You need to set TAILWIND_MODE=build if you are trying to do one off builds in development. We have to run some background watch processes and we can't reliably detect one off builds vs watchers to know if we should run them or not, so by default we assume you're running a watcher if NODE_ENV=development. Eventually we'll probably move this to the config file instead of an env variable 👍🏻

@vlados
Copy link
Author

vlados commented Mar 17, 2021

Is this for every build? Dev or production?

@vlados
Copy link
Author

vlados commented Mar 17, 2021

Something like this?

    "scripts": {
        "dev": "npm run development",
        "development": "TAILWIND_MODE=build mix",
        "watch": "TAILWIND_MODE=watch mix watch",
        "watch-poll": "TAILWIND_MODE=watch mix watch -- --watch-options-poll=1000",
        "hot": "TAILWIND_MODE=watch mix watch --hot",
        "prod": "npm run production",
        "production": "TAILWIND_MODE=build mix --production"
    },

@adamwathan
Copy link
Member

Yep that's exactly right, should do it!

@adamwathan
Copy link
Member

Going to close because this is covered in the README but happy to help still if you run into any snags 👍🏻

@vlados
Copy link
Author

vlados commented Mar 17, 2021

I can confirm it's working now and it was covered in the readme

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants