Skip to content

Commit d40762f

Browse files
prevent uneeded files from being uploaded to vercel
1 parent d3e07d4 commit d40762f

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

.vercelignore

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
# Git and version control
12
.git
3+
.github
4+
5+
# Build cache
6+
.next/cache
7+
.cache
8+
9+
# Reports and testing
210
reports
3-
.next/cache
11+
coverage
12+
__tests__
13+
14+
# Documentation (except README)
15+
docs/
16+
*.md
17+
!README.md
18+
19+
# Development files
20+
.vscode
21+
.idea
22+
23+
# Logs
24+
*.log
25+
logs
26+
27+
# Temporary files
28+
tmp
29+
temp
30+
31+
# Test files
32+
*.test.ts
33+
*.test.tsx
34+
*.test.js
35+
*.test.jsx
36+
*.spec.ts
37+
*.spec.tsx
38+
*.spec.js
39+
*.spec.jsx

next.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ const nextConfig = {
2626

2727
experimental: {},
2828

29+
// Exclude heavy dependencies from functions that don't need them
30+
outputFileTracingExcludes: {
31+
// Exclude @vercel/og from all API routes except /api/og/generate
32+
'/api/!(og)/**': ['node_modules/@vercel/og/**/*'],
33+
'/api/og/fetch': ['node_modules/@vercel/og/**/*'],
34+
},
35+
36+
// Include only necessary files for specific routes
37+
outputFileTracingIncludes: {
38+
'/api/og/generate': [],
39+
},
40+
2941
webpack(config, { isServer }) {
3042
config.module.rules.push({
3143
test: /\.svg$/,
@@ -38,6 +50,16 @@ const nextConfig = {
3850
};
3951
}
4052

53+
// Optimize for serverless functions
54+
if (isServer) {
55+
// Enable tree-shaking for server bundles
56+
config.optimization = {
57+
...config.optimization,
58+
usedExports: true,
59+
sideEffects: false,
60+
};
61+
}
62+
4163
return config;
4264
},
4365

0 commit comments

Comments
 (0)