altafino / react-webpack-5-tailwind-2

React 17 Boilerplate with Webpack 6, Tailwind 2, using babel, SASS/PostCSS, HMR, dotenv and an optimized production build
MIT License
295 stars 68 forks source link

builded css file 3MB #23

Open fbeqirllari opened 3 years ago

schmanat commented 3 years ago

Hi @bucibucii

I don't know whats your problem realy is, so I can only guess whats going on. The default tailwind.config.js purges all files stored in die /src/ folder and only *.js files. So if you are using another extension like jsx the nothing will be purged an you have the whole Tailwind CSS (and its about 3MB).

Since Tailwind v2 they also use the JIT module. I'm also working with JIT and its works great. If you want to use it, you habe only to enable it in the tailwind.config.js with mode: 'jit':

module.exports = {
  mode: 'jit'
  purge: ['./src/**/*.js'],
  darkMode: false, // or 'media' or 'class'
  theme: {
    extend: {},
  },
  variants: {
    extend: {},
  },
  plugins: [],
}