Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
whes1015 committed Dec 13, 2024
1 parent 5ddb71a commit ecf9c61
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
22 changes: 21 additions & 1 deletion next.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
import type { NextConfig } from "next";

const isProduction = process.env.NODE_ENV === "production";
const basePath = isProduction ? "/blog" : "";

const nextConfig: NextConfig = {
/* config options here */
output: "export",
basePath: basePath,
assetPrefix: basePath,
images: {
unoptimized: true,
},
webpack: (config) => {
config.module.rules.push({
test: /\.md$/,
use: "raw-loader",
});

if (isProduction) {
config.output.publicPath = `${basePath}/_next/`;
}

return config;
},
};

export default nextConfig;
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import "@/app/globals.css";
import { useEffect } from "react";
import AppHeader from "@/components/Header";
import AppHeader from "@/components/Header1";

export default function RootLayout({
children,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import matter from "gray-matter";

const isProduction = process.env.NODE_ENV === "production";
const GITHUB_RAW_URL =
"https://raw.githubusercontent.com/whes1015/whes1015/main/public";
"https://raw.githubusercontent.com/ExpTechTW/blog/main/public";

const baseUrl = isProduction
? `${GITHUB_RAW_URL}/blogs`
Expand Down

0 comments on commit ecf9c61

Please sign in to comment.