From f270ea4b8ea04cddc544433055a92882ba9fe5b1 Mon Sep 17 00:00:00 2001 From: Ephraim Atta-Duncan Date: Sat, 25 Nov 2023 09:28:13 +0000 Subject: [PATCH] feat: add millionjs to marketing page --- .../{next.config.js => next.config.mjs} | 25 +++++++++++++------ apps/marketing/package.json | 1 + apps/marketing/tsconfig.json | 1 + 3 files changed, 20 insertions(+), 7 deletions(-) rename apps/marketing/{next.config.js => next.config.mjs} (82%) diff --git a/apps/marketing/next.config.js b/apps/marketing/next.config.mjs similarity index 82% rename from apps/marketing/next.config.js rename to apps/marketing/next.config.mjs index 41a80c12c..ad6498d73 100644 --- a/apps/marketing/next.config.js +++ b/apps/marketing/next.config.mjs @@ -1,12 +1,19 @@ /* eslint-disable @typescript-eslint/no-var-requires */ -const fs = require('fs'); -const path = require('path'); -const { withContentlayer } = require('next-contentlayer'); +import dotenv from 'dotenv'; +import fs from 'fs'; +import million from 'million/compiler'; +import { withContentlayer } from 'next-contentlayer'; +import path from 'path'; +import { fileURLToPath } from 'url'; +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +// eslint-disable-next-line turbo/no-undeclared-env-vars const ENV_FILES = ['.env', '.env.local', `.env.${process.env.NODE_ENV || 'development'}`]; ENV_FILES.forEach((file) => { - require('dotenv').config({ + dotenv.config({ path: path.join(__dirname, `../../${file}`), }); }); @@ -48,7 +55,7 @@ const config = { return config; }, - async headers() { + headers() { return [ { source: '/:path*', @@ -82,7 +89,7 @@ const config = { }, ]; }, - async rewrites() { + rewrites() { return [ { source: '/ingest/:path*', @@ -92,4 +99,8 @@ const config = { }, }; -module.exports = withContentlayer(config); +export default million.next(withContentlayer(config), { + auto: { + rsc: true, + }, +}); diff --git a/apps/marketing/package.json b/apps/marketing/package.json index ab72ce6c8..448408b7c 100644 --- a/apps/marketing/package.json +++ b/apps/marketing/package.json @@ -24,6 +24,7 @@ "lucide-react": "^0.279.0", "luxon": "^3.4.0", "micro": "^10.0.1", + "million": "^2.6.4", "next": "14.0.0", "next-auth": "4.24.3", "next-contentlayer": "^0.3.4", diff --git a/apps/marketing/tsconfig.json b/apps/marketing/tsconfig.json index b4ec2832f..a42736f64 100644 --- a/apps/marketing/tsconfig.json +++ b/apps/marketing/tsconfig.json @@ -18,6 +18,7 @@ }, "include": [ "next-env.d.ts", + "**/*.mjs", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts",