79829770

Date: 2025-11-25 13:40:59
Score: 1.5
Natty:
Report link

@rozsazoltan thanks for the answer. i just tried the suggested code and found it's not working

  1. the types are wrong - lightningcss.Targets expects numbers as values
  2. i tried to use targets option the way the docs suggested using baseline newly available and baseline 2023 to test the build, but it was not working
import { defineConfig } from 'vite';
import tailwindcss from '@tailwindcss/vite';
import { browserslistToTargets } from 'lightningcss';
import browserslist from 'browserslist';

export default defineConfig({
  plugins: [tailwindcss()],
  css: {
    lightningcss: {
      // did not help
      targets: browserslistToTargets(browserslist('baseline newly available')),
    },
  },
});

the problem is in fact in lightningcss so i just switched to esbuild (do not forget to install esbuild as dev dependency)

import { defineConfig } from 'vite';
import tailwindcss from '@tailwindcss/vite';

export default defineConfig({
  plugins: [tailwindcss()],
  build: {
    cssMinify: 'esbuild',
  },
});
Reasons:
  • Blacklisted phrase (0.5): thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @rozsazoltan
  • Low reputation (1):
Posted by: Rassul