web-infra-dev / modern.js

Modern.js is a web engineering system, including a web framework and a npm package solution.
https://modernjs.dev/en/
MIT License
4.44k stars 366 forks source link

[Bug]: tailwind.config.ts config changes not applied until full restart #6464

Open roonie007 opened 5 days ago

roonie007 commented 5 days ago

Version

System:
  OS: Linux 5.15 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
  CPU: (16) x64 12th Gen Intel(R) Core(TM) i5-12600K
  Memory: 15.63 GB / 27.30 GB
  Container: Yes
  Shell: 5.2.21 - /bin/bash
npmPackages:
  @modern-js/app-tools: 2.60.5 => 2.60.5 
  @modern-js/plugin-tailwindcss: 2.60.5 => 2.60.5 
  @modern-js/runtime: 2.60.5 => 2.60.5 
  @modern-js/tsconfig: 2.60.5 => 2.60.5 

Details

I followed this guide to integrate Tailwindcss and it works perfectly, but the problem is when I change the content of tailwind.config.ts nothing happens, I have to manually restart the server so the changes are applied.

Here is my modern.config.ts

import { appTools, defineConfig } from "@modern-js/app-tools";
import { tailwindcssPlugin } from "@modern-js/plugin-tailwindcss";

// https://modernjs.dev/en/configure/app/usage
export default defineConfig<"rspack">({
  runtime: {
    router: true,
  },
  plugins: [appTools({ bundler: "rspack" }), tailwindcssPlugin()],
  bff: {
    enableHandleWeb: true,
  },
  server: {
    ssr: true,
    port: Number(process.env.PORT || "3000"),
  },
  dev: {
    watchFiles: [
      {
        paths: "tailwind.config.ts",
        type: "reload-server",
      },
    ],
  },
});

As you can see I even added the tailwind.config.ts file to the watchFiles but still the server is not reloaded when I save.

Reproduce link

No Need

Reproduce Steps

  1. Start a new project
  2. Add TailwindCSS
  3. Make any change to the tailwind config file and save
roonie007 commented 5 days ago

After removing the node_modules folder and reinstalling with yarn install, the file is now watched, and the server restarts correctly. However, if I make a change in the Tailwind config, like adjusting a color, the server is restarted but the changes aren’t applied until I fully restart the server.