Skip to content

Commit

Permalink
Merge pull request #10 from 6drf21e/fix/google-analytics-and-prod-deps
Browse files Browse the repository at this point in the history
Update next.config.mjs and package.json
  • Loading branch information
fatwang2 authored Mar 30, 2024
2 parents f503915 + 19b599e commit 010e8e6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ WORKDIR /app

# Install dependencies
COPY ./web/package*.json ./
ENV NODE_ENV production
RUN npm install
COPY ./web .

# Compile Next.js and configure distDir
RUN sed -i 's/distDir:.*/distDir: process.env.NEXT_DIST_DIR || ".\/ui"/' next.config.mjs
ENV NODE_ENV production
ENV NEXT_DIST_DIR ./NEXT_BUILD
RUN npm run build

Expand Down
3 changes: 3 additions & 0 deletions web/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export default (phase, { defaultConfig }) => {
output: "export",
assetPrefix: "/ui/",
basePath: "/ui",
experimental: {
missingSuspenseWithCSRBailout: false
},
distDir: "../ui"
};
} else {
Expand Down
42 changes: 14 additions & 28 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
"@next/third-parties": "^14.0.4",
"@radix-ui/react-popover": "^1.0.7",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.10",
"@upstash/ratelimit": "^1.0.0",
"@vercel/kv": "^1.0.1",
"autoprefixer": "^10.0.1",
"clsx": "^2.1.0",
"headlessui": "^0.0.0",
"lucide-react": "^0.309.0",
Expand All @@ -26,22 +28,20 @@
"react-dom": "^18",
"react-markdown": "^9.0.1",
"tailwind-merge": "^2.2.0",
"tailwindcss": "^3.3.0",
"typescript": "^5",
"unist-builder": "^4.0.0"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.10",
"@types/node": "^20",
"@types/node": "20.11.30",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10.0.1",
"eslint": "^8",
"eslint-config-next": "14.0.4",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-unused-imports": "^3.0.0",
"postcss": "^8",
"prettier": "^3.1.0",
"tailwindcss": "^3.3.0",
"typescript": "^5"
"prettier": "^3.1.0"
}
}
4 changes: 3 additions & 1 deletion web/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
<GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS || ""} />
{process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS && (
<GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS} />
)}
</html>
);
}

0 comments on commit 010e8e6

Please sign in to comment.