You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having a bit of an issue with migrating to Tailwind v4.
I have migrated from SCSS to CSS (at least for the core Tailwind parts of my project) I've left a few other things in SCSS for now.
My issue is prod build is working fine but when running in dev mode; on initial build it registers changes in all CSS and builds accordingly but while Rspack watches files it is not applying/building changes in nested/@import CSS file includes during the watch, I need to make a change in one of the nested CSS files and then save root index.css for these changes to have an affect.
// rspack.dev.js// Increase EventEmitter max listeners (useful if you run into warnings)require('events').EventEmitter.defaultMaxListeners=50;// or higher if neededconst{ merge }=require('webpack-merge');const{ rspack }=require('@rspack/core');constcommon=require('./rspack.common.js');constpath=require('path');module.exports=merge(common,{mode: 'development',// Source maps for easier debuggingdevtool: 'cheap-module-source-map',// Setting it to `true` is typical in dev mode.cache: true,output: {path: path.resolve(__dirname,'dist'),filename: '[name].[contenthash].js',publicPath: '/assets/',clean: true,},module: {rules: [// Add this rule first in the rules array{test: /\.css$/,include: [path.resolve(__dirname,'tailwind')],use: [rspack.CssExtractRspackPlugin.loader,{loader: 'postcss-loader',options: {postcssOptions: {plugins: [require('@tailwindcss/postcss')],},},}],type: 'css'// Keep as 'css' since we have experiments.css enabled},// Then modify the existing CSS rule to exclude the tailwind directory// CSS Files{test: /\.css$/,// Matches CSS filesexclude: [path.resolve(__dirname,'tailwind')],use: [rspack.CssExtractRspackPlugin.loader,{loader: 'css-loader',options: {sourceMap: true,// Enable source maps for CSSimportLoaders: 1,},},{loader: 'postcss-loader',options: {sourceMap: true,// Enable source maps for PostCSS},},],sideEffects: true,},// SCSS Files{test: /\.scss$/,// Matches SCSS filesuse: [rspack.CssExtractRspackPlugin.loader,// Extract CSS into separate files{loader: 'css-loader',options: {sourceMap: true,// Enable source maps for CSSimportLoaders: 2,},},{loader: 'postcss-loader',options: {sourceMap: true,// Enable source maps for PostCSS},},{loader: 'sass-loader',options: {sourceMap: true,// Enable source maps for Sass},},],exclude: /node_modules/,},],},// Watch options for local developmentwatchOptions: {aggregateTimeout: 300,poll: 1000,ignored: ['**/dist/**','**/static/**','**/node_modules/**','**/.turbo/**','**/.build_cache/**'],followSymlinks: false,},// Performance hints usually not needed in devperformance: {hints: false,},// Dev-friendly optimizationsoptimization: {removeAvailableModules: false,removeEmptyChunks: false,splitChunks: false,minimize: false,},// Plugins for devplugins: [newrspack.CssExtractRspackPlugin({// If you'd rather avoid hashing in dev for faster rebuilds, consider '[name].css'filename: '[name].[contenthash].css',ignoreOrder: true,}),newrspack.ProgressPlugin({prefix: 'Development Build',profile: true,template: '● {prefix:.bold.blue} {bar:25.cyan/white.dim} ({percent}%) {wide_msg:.dim}',}),],});
Tailwind Entry point
/* ================== External Fonts==================*//* Needed to be imported before tailwindcss */@import'./font.css';
/* =============== Tailwind Core===============*/@import"tailwindcss"; /* Base Tailwind *//* ========================= Tailwind Source Files=========================*/@import'./source.css'; /* Source file paths for Tailwind to look for *//* ============================= Tailwind Theme Variables=============================*/@import'./theme-variables/animations.css';
@import'./theme-variables/breakpoints.css';
@import'./theme-variables/colors.css';
@import'./theme-variables/layouts.css';
@import'./theme-variables/typography.css';
/* =============================== Tailwind Utility Classes===============================*/@import'./utilities/borders.css';
@import'./utilities/collapse.css';
@import'./utilities/container.css';
@import'./utilities/display.css';
@import'./utilities/grid-template-columns.css';
@import'./utilities/prose.css';
@import'./utilities/shadows.css';
@import'./utilities/spacer.css';
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm having a bit of an issue with migrating to Tailwind v4.
I have migrated from SCSS to CSS (at least for the core Tailwind parts of my project) I've left a few other things in SCSS for now.
My issue is prod build is working fine but when running in dev mode; on initial build it registers changes in all CSS and builds accordingly but while Rspack watches files it is not applying/building changes in nested/@import CSS file includes during the watch, I need to make a change in one of the nested CSS files and then save root index.css for these changes to have an affect.
rspack.common.js
rspack.dev.js
Tailwind Entry point
Beta Was this translation helpful? Give feedback.
All reactions