Reputation: 1812
I am trying to remove the unused css during build process. npm run build => "build": "tsc && vite build --base=/root/",
I am getting error message like below cannot read property 'match' of undefined
Tailwind config entry:
purge: [{ enabled: true, content: ['./src/**/*.tsx'] }],
Upvotes: 1
Views: 2223
Reputation: 187
The purge
option has been deprecated since tailwind version 3. Use the content
field to configure the paths to any file (e.g, HTML, JavaScript, CSS, etc.) that contain Tailwind class names instead of the purge field.
// tailwind.config.js
export default {
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}', './public/**/*.html'],
plugins: [],
};
Upvotes: 0
Reputation: 1749
Try use this config,
// tailwind.config.js
module.exports = {
mode: 'jit',
purge: {
enabled: process.env.NODE_ENV === 'production',
safeList: [],
content: ['./index.html', './src/**/*.tsx', './src/**/*.ts'],
},
Upvotes: 2