I’m deploying to Deno Deploy, and I noticed that the generated build artifacts grows with each buld. it was ~101 MB, now it is 150 MB. my actual assets are less than 1 MB. I use Deno + Vite + React (and i need node_modules)
It is not node_modules folder problem. I removed it after build and still got artifacts 101 MB. I also tried to create new branch with bare minimum and my artifacts jumped from 101 MB to 150 MB.
How can I control artifacts in deno deploy?
Logs from deno deploy:
Executing build command
Task deno task build && rm -rf node_modules
Task build deno run -A --node-modules-dir npm:vite build
vite v6.3.5 building for production...
Generated route tree in 81ms
transforming...
✓ 955 modules transformed.
rendering chunks...
computing gzip size...
ist/assets/index-DRFX6L5t.js 377.20 kB │ gzip: 117.28 kB
dist/assets/Editor-CoIp3zDK.js 1,236.99 kB │ gzip: 415.69 kB
(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
✓ built in 5.82s
Caching dependencies for the entrypoint
Preparing build artifact
[===============================================| ] 15700/19393 80%
[===========================================================-] 19393/19393 100%
Uploading build artifact (101 MB)
Build finished
deno.json
{
"nodeModulesDir": "auto",
"tasks": {
"install": "deno install",
"dev": "deno run -A --node-modules-dir npm:vite",
"build": "deno run -A --node-modules-dir npm:vite build",
"analyze": "deno run -A --node-modules-dir npm:vite build --mode analyze",
"preview": "deno run -A --node-modules-dir npm:vite preview",
"serve": "deno run --allow-net --allow-read jsr:@std/http@1/file-server dist/",
"start": "deno run --allow-net --allow-read --allow-env --env main.ts"
},
"compilerOptions": {
"lib": ["ES2021", "DOM", "DOM.Iterable"],
"jsx": "react-jsx",
"jsxImportSource": "react",
"jsxImportSourceTypes": "@types/react"
},
}
vite.config.ts
import { defineConfig } from "vite";
import deno from "@deno/vite-plugin";
import react from "@vitejs/plugin-react-swc";
import { tanstackRouter } from "@tanstack/router-plugin/vite";
export default defineConfig({
plugins: [
deno(),
tanstackRouter({
target: "react",
autoCodeSplitting: true,
}),
react(),
],
});