PageSpeed Insights Optimization

Im using vite project and rollup to bundle my project, it contains only 1 glb model and some basic camera, lightning setup.
Even after the build process, there is pretty decent amount of unused js code.

// vite.config.js
import { defineConfig } from 'vite';
import { resolve } from 'path';

export default defineConfig({
  base: './', 
  build: {
    outDir: 'dist', 
    rollupOptions: {
   
      input: resolve(__dirname, 'index.html'),
      output: {
     
        entryFileNames: 'js/[name]-[hash].js',
        chunkFileNames: 'js/[name]-[hash].js',
    
        assetFileNames: assetInfo => {
          if (assetInfo.name && assetInfo.name.endsWith('.css')) {
            return 'css/[name]-[hash][extname]';
          }
         
          if (assetInfo.name && /\.(png|jpe?g|gif|svg)$/.test(assetInfo.name)) {
            return 'img/[name]-[hash][extname]';
          }
          return '[name]-[hash][extname]';
        }
      }
    },
    
    minify: 'terser'
  }
});


{
  "name": "threejs-laptop",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "deploy": "node deploy.js",
    "build:deploy": "npm run build && npm run deploy"
  },
  "devDependencies": {
    "@fullhuman/postcss-purgecss": "^7.0.2",
    "autoprefixer": "^10.4.20",
    "cssnano": "^7.0.6",
    "postcss": "^8.5.1",
    "postcss-cli": "^11.0.0",
    "terser": "^5.38.1",
    "vite": "^6.1.0"
  },
  "dependencies": {
    "gsap": "^3.12.7",
    "lil-gui": "^0.20.0",
    "matter-js": "^0.20.0",
    "ssh2-sftp-client": "^11.0.0",
    "stats.js": "^0.17.0",
    "three": "^0.173.0"
  }
}

I wonder why its not being properly tree shaked

Three is heavy!