Closed MartinPeverelli closed 3 years ago
Yep nothing we can do to change this easily/automatically I'm afraid, that's why we have configuration options for enabling Purge manually:
https://tailwindcss.com/docs/optimizing-for-production#enabling-manually
You can also just run NODE_ENV=production npm run build
from the command line 👍🏻
Thanks! Works like a charm!
Added this to my package.json
"scripts": {
"dev": "vite",
"build": "NODE_ENV=production vite build"
},
Hello.
I also have the same issue and I tried adding that to my package.json but I end up getting 'NODE_ENV' is not recognized as an internal or external command.
Olá.
Eu também tenho o mesmo problema e tentei adicionar isso ao meu package.json, mas acabo ficando 'NODE_ENV' não é reconhecido como um comando interno ou externo.
Aqui também.
Describe the problem:
Using
npm run build
on a Vite project does not purge unused styles.Link to a minimal reproduction:
Reproduction repository: https://github.com/MartinPeverelli/vite-tailwind-purge
npm install
npm run build
Result:
Manual steps:
Theory, if I may:
Vite no longer uses
process.env.NODE_ENV
to signal it is running in production, it usesimport.meta.env.MODE
(Vite docs) This, then does not trigger the automatic purge insrc/lib/purgeUnusedStyles.js