Skip to content

Commit 7e46691

Browse files
authored
feat(build): added turbopack builds to prod (#630)
* added turbopack to prod builds * block access to sourcemaps * revert changes to docs
1 parent ede224a commit 7e46691

File tree

4 files changed

+31
-50
lines changed

4 files changed

+31
-50
lines changed

apps/docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"fumadocs-mdx": "^11.5.6",
2020
"fumadocs-ui": "^15.0.16",
2121
"lucide-react": "^0.511.0",
22-
"next": "^15.2.3",
22+
"next": "^15.3.2",
2323
"next-themes": "^0.4.6",
2424
"react": "19.1.0",
2525
"react-dom": "19.1.0",

apps/sim/next.config.ts

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const nextConfig: NextConfig = {
2424
},
2525
experimental: {
2626
optimizeCss: true,
27+
turbopackSourceMaps: false,
2728
},
2829
...(env.NODE_ENV === 'development' && {
2930
allowedDevOrigins: [
@@ -41,36 +42,6 @@ const nextConfig: NextConfig = {
4142
],
4243
outputFileTracingRoot: path.join(__dirname, '../../'),
4344
}),
44-
webpack: (config, { isServer, dev }) => {
45-
// Skip webpack configuration in development when using Turbopack
46-
if (dev && env.NEXT_RUNTIME === 'turbopack') {
47-
return config
48-
}
49-
50-
// Configure webpack to use filesystem cache for faster incremental builds
51-
if (config.cache) {
52-
config.cache = {
53-
type: 'filesystem',
54-
buildDependencies: {
55-
config: [__filename],
56-
},
57-
cacheDirectory: path.resolve(process.cwd(), '.next/cache/webpack'),
58-
}
59-
}
60-
61-
// Avoid aliasing React on the server/edge runtime builds because it bypasses
62-
// the "react-server" export condition, which Next.js relies on when
63-
// bundling React Server Components and API route handlers.
64-
if (!isServer) {
65-
config.resolve.alias = {
66-
...config.resolve.alias,
67-
react: path.join(__dirname, '../../node_modules/react'),
68-
'react-dom': path.join(__dirname, '../../node_modules/react-dom'),
69-
}
70-
}
71-
72-
return config
73-
},
7445
transpilePackages: ['prettier', '@react-email/components', '@react-email/render'],
7546
async headers() {
7647
return [
@@ -144,6 +115,16 @@ const nextConfig: NextConfig = {
144115
},
145116
],
146117
},
118+
// Block access to sourcemap files (defense in depth)
119+
{
120+
source: '/(.*)\\.map$',
121+
headers: [
122+
{
123+
key: 'x-robots-tag',
124+
value: 'noindex',
125+
},
126+
],
127+
},
147128
// Apply security headers to all routes
148129
{
149130
source: '/:path*',

apps/sim/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dev:classic": "next dev",
1414
"dev:sockets": "bun run socket-server/index.ts",
1515
"dev:full": "concurrently -n \"NextJS,Realtime\" -c \"cyan,magenta\" \"bun run dev\" \"bun run dev:sockets\"",
16-
"build": "next build",
16+
"build": "next build --turbopack",
1717
"start": "next start",
1818
"prepare": "cd ../.. && bun husky",
1919
"db:push": "bunx drizzle-kit push",

bun.lock

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)