Skip to content

Function names not minified #170

Description

@arwinvdv

Describe the bug

I'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

Reproduction

https://github.com/arwinvdv/vue3-template

Steps to reproduce

Checkout this repo: https://github.com/arwinvdv/vue3-template

Run:

npm install
npm run build

In the created js file the functions customFunctionThatIsNotMinified and anotherCustomFunctionThatIsNotMinified are visible.

System Info

System:
    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 Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions