Function names not minified #171
-
Describe the bugI'm using vite-plugin-vue to build my Vue 3 app and I noticed that the function names are not minified in the production build. This increases the bundle size and exposes some implementation details that I would rather keep hidden. I checked the vite.config.js file and I have minify: 'terser' set as an option, but it doesn't seem to have any effect on the function names. Is this a bug or a limitation of the plugin? Is there any way to enable function name minification with vite-plugin-vue? I created a example repo, here the changes to recreate: arwinvdv/vue3-template@18c6cb8 Reproductionhttps://github.com/arwinvdv/vue3-template Steps to reproduceCheckout this repo: https://github.com/arwinvdv/vue3-template Run:
In the created js file the functions System InfoSystem:
OS: macOS 13.3.1
CPU: (10) arm64 Apple M1 Max
Memory: 66.70 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.9.1 - ~/.nvm/versions/node/v18.9.1/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.9.1/bin/yarn
npm: 8.19.1 - ~/.nvm/versions/node/v18.9.1/bin/npm
Browsers:
Chrome: 113.0.5672.63
Edge: 112.0.1722.68
Firefox: 112.0.2
Safari: 16.4
npmPackages:
@vitejs/plugin-vue: ^4.0.0 => 4.2.1
vite: ^4.1.4 => 4.3.5 Used Package Managernpm LogsNo response Validations
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
esbuild and terser both have an option to do that but it has some caveats. |
Beta Was this translation helpful? Give feedback.
-
@sapphi-red Thanks for the response! I tried in esbuild and terser both with this configuration in vite.config.js, but unfortunately no difference:
And with esbuild:
|
Beta Was this translation helpful? Give feedback.
esbuild and terser both have an option to do that but it has some caveats.
https://esbuild.github.io/api/#mangle-props