This also happens in testing where the bundler attaches to the test:prepare task to ensure the stylesheets have been bundled before testing commences. (Note that this currently only applies to rails test:* tasks (like test:all or test:controllers), not "rails test", as that doesn't load test:prepare).

If your test framework does not define a test:prepare Rake task, ensure that your test framework runs css:build to bundle stylesheets before testing commences. If your setup uses jsbundling-rails (ie, esbuild + tailwind), you will also need to run javascript:build.

That's it!

You can configure your bundler options in the build:css script in package.json or via the installer-generated tailwind.config.js for Tailwind or postcss.config.js for PostCSS.