Prevent Specific File Minification

Hello! Does anyone have experience in preventing specific files from being minified when deploying to 'production'? Or are there any specific Gadget methods in implementing? Running into an issue with SurveyJS and some custom styling/code that works great in my development and testing environments but then is completely different on the production environment. Thanks!
5 Replies
Chocci_Milk
Chocci_Milk3w ago
Hello, I would recommend that you take a look at the Vite configuration documentation to see whats possible on that front: https://vite.dev/config/
webzer33
webzer333w ago
Hello, @[Gadget] Antoine . @Ruscion and I are working on the same project so I wanted to chime in as well with our findings. We've followed the steps of the vite documentation to no avail. We've tried preventing minification of our CSS which didn't seem to take. Could you maybe give us some more insight on how we would be able to tell if it was minified or not? We see our styles coming in, so we know that they are present in our project. One major concern is that we are working with SurveyJS and our custom styles work on dev, but not prod. However, we got them towork when we added important to every single one of our custom CSS properties. Does this mean the minification doesn't respect the order of our imports? Is there a common convention that we should follow that will make our order of imports more explicit for the bundling process? We also have some JS that we're suspecting is also a victim of the same issue with CSS.
Chocci_Milk
Chocci_Milk3w ago
I'll get to this as soon as possible. Meanwhile, please note that it is against our server rules to ping (@) Gadget employees unless its an emergency or we haven't responded within 24 hours of your message (during our 9-5 Mon-Fri EST work week) I was wondering if you folks had asked ChatGPT or Claude to help you with this issue. I asked it and it gave me a few steps to follow for debugging this Make sure to inform it of the frontend framework you're using
Ruscion
RuscionOP3w ago
Hi Antoine, I did some extensive debugging with different AI tools and still was unable to resolve the issue. This included things like vite.config.mts settings to try and prevent the entire application from running a minification to targeting specific CSS/JS files from running. So far we have not found a resolution and were hoping the Gadget team had further information into the matter or a solution.
Chocci_Milk
Chocci_Milk2w ago
Have you folks seen these Vite docs? https://vite.dev/config/build-options.html#build-cssminify I really don't think that we modify anything on build time. We use the configurations set by your vite config and unless we have something weird in the defaults (which I doubt) the minification process is probably being bugged by something else

Did you find this page helpful?