Adding purge whitelist options breaks Production Build
See original GitHub issueVersion
@nuxtjs/tailwindcss: 1.4.1 nuxt: 2.11.0
Reproduction Link
None as Build fails, bug is in dev env.
Steps to reproduce
Add purge options as mentioned in the docs - https://tailwindcss.com/docs/controlling-file-size/#removing-unused-css
Example:
module.exports = {
purge: {
options: {
whitelistPatterns: [/agile*/],
whitelistPatternsChildren: [/agile*/]
}
},
variants: {},
plugins: []
}
What is Expected?
Skip the agile classes and add them in the css output in production build
What is actually happening?
Breaks the production build with the below error.
ERROR in ./.nuxt/components/nuxt-loading.vue?vue&type=style&index=0&lang=css& (./node_modules/css-loader/dist/cjs.js??ref--3-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--3-oneOf-1-2!./node_modules/vue-loader/lib??vue-loader-options!./node_modules/string-replace-loader??ref--12!./.nuxt/components/nuxt-loading.vue?vue&type=style&index=0&lang=css&)
8:10:13 PM: Module build failed (from ./node_modules/postcss-loader/src/index.js):
8:10:13 PM: TypeError: Cannot read property 'filter' of undefined
8:10:13 PM: at /opt/build/repo/node_modules/tailwindcss/node_modules/@fullhuman/postcss-purgecss/lib/postcss-purgecss.js:1:483
8:10:13 PM: at LazyResult.run (/opt/build/repo/node_modules/postcss/lib/lazy-result.js:295:14)
8:10:13 PM: at LazyResult.asyncTick (/opt/build/repo/node_modules/postcss/lib/lazy-result.js:208:26)
8:10:13 PM: at LazyResult.asyncTick (/opt/build/repo/node_modules/postcss/lib/lazy-result.js:221:14)
8:10:13 PM: at LazyResult.asyncTick (/opt/build/repo/node_modules/postcss/lib/lazy-result.js:221:14)
8:10:13 PM: at LazyResult.asyncTick (/opt/build/repo/node_modules/postcss/lib/lazy-result.js:221:14)
8:10:13 PM: at LazyResult.asyncTick (/opt/build/repo/node_modules/postcss/lib/lazy-result.js:221:14)
8:10:13 PM: at LazyResult.asyncTick (/opt/build/repo/node_modules/postcss/lib/lazy-result.js:221:14)
8:10:13 PM: at LazyResult.asyncTick (/opt/build/repo/node_modules/postcss/lib/lazy-result.js:221:14)
8:10:13 PM: at LazyResult.asyncTick (/opt/build/repo/node_modules/postcss/lib/lazy-result.js:221:14)
8:10:13 PM: at /opt/build/repo/node_modules/postcss/lib/lazy-result.js:250:14
8:10:13 PM: at new Promise (<anonymous>)
8:10:13 PM: at LazyResult.async (/opt/build/repo/node_modules/postcss/lib/lazy-result.js:246:23)
8:10:13 PM: at LazyResult.then (/opt/build/repo/node_modules/postcss/lib/lazy-result.js:127:17)
8:10:13 PM: at LazyResult.asyncTick (/opt/build/repo/node_modules/postcss/lib/lazy-result.js:212:17)
8:10:13 PM: at LazyResult.asyncTick (/opt/build/repo/node_modules/postcss/lib/lazy-result.js:221:1
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:12
Top Results From Across the Web
Adding purge whitelist options breaks Production Build #122
Breaks the production build with the below error. ERROR in ./.nuxt/components/nuxt-loading.vue?vue&type=style&index=0&lang=css& (./node_modules/ ...
Read more >Optimizing for Production - Tailwind CSS
For the smallest possible production build, we recommend minifying your CSS with a tool like cssnano, and compressing your CSS with Brotli.
Read more >Fix Hyvä Purge breaks in CSS During Production Builds
To fix this solution, as you develop your theme include any dynamically generated classes in the purge options section of the tailwind.config.js ...
Read more >Tailwind styles broken in production - Laracasts
It seems after purgecss runs the styles break. If I upload the full 3MB+ css file to the production server all works fine....
Read more >Tailwind CSS Styles Getting Removed in Production
Purgecss also has a whitelist option which I'll be using. Hope this answer helps anyone who is getting their custom styles removed by...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same issue here. Whitelisting not working at all…(nuxt 2.13)
Nope, does not work. I tried manually adding every single agile class in the whitelist array, it still didnt work.
I know its not vue-agile’s issue because it works in dev server.
How it looks in dev server
Here is how it looks in production build
I even tried
The slider still wont work, this is very frustating, I used to work with tailwindcss and nuxt every single time in my work flow and never came across this issue.