How to output minified code when running dev server #6221
Unanswered
mickey-vershbow
asked this question in
Q&A
Replies: 1 comment
-
Currently we are looking for same thing as Mickey proposed. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am working on a Vite/Vanilla JS application, and my team lead wants me to see if it's possible to output minified code when running the code in the development environment. Apparently this will be important down the line when setting up CI/CD pipeline.
My understanding of how Vite works is that it serves Native ESM to the browser in the development environment, and only bundles + minifies the code in production mode. Upon running both dev and prod servers and inspecting the code, this seems to be true.
I've spent hours trying to figure out how I can force minify the code in development. First of all, Vite ships with both Terser and esbuild for minifying. According to the Vite docs, it defaults to esbuild, and you can set build.minify: Terser in the config file if you want to use Terser. However as far as I can tell, there is no info in the docs (for Vite or either of the plugins) about force minifying in the dev environment.
Any ideas would be greatly appreciated. See below for my config file code:
package.json
Beta Was this translation helpful? Give feedback.
All reactions