Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 39 additions & 24 deletions apps/web/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import bundleAnalyzer from "@next/bundle-analyzer";
import { withSentryConfig } from "@sentry/nextjs";

const shouldRunBundleAnalyzer = process.env.ANALYZE === "true";
const svgComponentLoaders = ["@svgr/webpack"];

const withBundleAnalyzer = bundleAnalyzer({
enabled: process.env.ANALYZE === "true",
enabled: shouldRunBundleAnalyzer,
});

const imageRemotePatterns = [
Expand All @@ -19,6 +22,14 @@ const imageRemotePatterns = [
/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ["@solid-connect/ai-inspector"],
turbopack: {
rules: {
"*.svg": {
loaders: svgComponentLoaders,
as: "*.js",
},
},
},
images: {
unoptimized: true,
remotePatterns: imageRemotePatterns,
Expand Down Expand Up @@ -48,31 +59,35 @@ const nextConfig = {
typescript: {
ignoreBuildErrors: true,
},
webpack: (config) => {
// CSS 최적화 - ensure nested objects exist
if (!config.optimization) {
config.optimization = {};
}
if (!config.optimization.splitChunks) {
config.optimization.splitChunks = {};
}
if (!config.optimization.splitChunks.cacheGroups) {
config.optimization.splitChunks.cacheGroups = {};
}
...(shouldRunBundleAnalyzer
? {
webpack: (config) => {
// Bundle analyzer still runs through webpack because it is webpack-plugin based.
if (!config.optimization) {
config.optimization = {};
}
if (!config.optimization.splitChunks) {
config.optimization.splitChunks = {};
}
if (!config.optimization.splitChunks.cacheGroups) {
config.optimization.splitChunks.cacheGroups = {};
}

config.optimization.splitChunks.cacheGroups.styles = {
name: "styles",
test: /\.(css|scss)$/,
chunks: "all",
enforce: true,
};
config.optimization.splitChunks.cacheGroups.styles = {
name: "styles",
test: /\.(css|scss)$/,
chunks: "all",
enforce: true,
};

config.module.rules.push({
test: /\.svg$/,
use: ["@svgr/webpack"],
});
return config;
},
config.module.rules.push({
test: /\.svg$/,
use: svgComponentLoaders,
});
return config;
},
}
: {}),
};

export default withSentryConfig(
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build --webpack",
"build": "next build",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore --webpack in the build script

Switching apps/web to "build": "next build" enables Turbopack by default in Next 16, but this app still defines a custom webpack function in apps/web/next.config.mjs (lines 59-83). In this configuration, next build fails when a webpack config is present, so the standard pnpm --filter @solid-connect/web build path can break in CI/release builds. Keep --webpack until the webpack block is removed/migrated, or explicitly migrate to a Turbopack-only config path.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

반영했습니다. build를 다시 webpack으로 되돌리면 이번 PR의 Turbopack 전환 목표가 사라져서, 일반 빌드에서는 커스텀 webpack 설정을 노출하지 않도록 ANALYZE=true일 때만 webpack 설정을 붙이게 분리했습니다. 기본 pnpm --filter @solid-connect/web buildNext.js 16.2.6 (Turbopack) 경로로 통과했고, pnpm --filter @solid-connect/web analyzenext build --webpack 경로로 .next/analyze/{client,nodejs,edge}.html 리포트 생성까지 확인했습니다.

"start": "next start",
"lint": "biome check --write .",
"lint:check": "biome check .",
Expand Down
Loading