Skip to content

Commit 57d5531

Browse files
Next: Optimized for Production
1 parent c0fec83 commit 57d5531

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

Projects/blog-nextjs/components/home-page/hero.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const Hero = () => {
99
<Image src="/images/site/max.png" height={300} width={300} alt="Hero" />
1010
</div>
1111

12-
<h1>Hi, I'm Max</h1>
12+
<h1>Hi, I&apos;m Max</h1>
1313

1414
<p>
1515
I blog about Web Development - especially frameworks like React and
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import classes from "./logo.module.css";
22

33
const Logo = (props) => {
4-
return <div className={classes.logo}>Max's Next Blog</div>;
4+
return <div className={classes.logo}>Max&apos;s Next Blog</div>;
55
};
66

77
export default Logo;

Projects/blog-nextjs/components/posts/post-detail/post-content.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@ import ReactMarkdown from "react-markdown";
22
import classes from "./post-content.module.css";
33
import PostHeader from "./post-header";
44
import Image from "next/image";
5-
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
6-
import { dark } from "react-syntax-highlighter/dist/cjs/prism";
5+
import { PrismLight as SyntaxHighlighter } from "react-syntax-highlighter";
6+
import atomDark from "react-syntax-highlighter/dist/cjs/styles/prism/atom-dark";
7+
import js from "react-syntax-highlighter/dist/cjs/languages/prism/javascript";
8+
import jsx from "react-syntax-highlighter/dist/cjs/languages/prism/jsx";
9+
import css from "react-syntax-highlighter/dist/cjs/languages/prism/css";
10+
11+
SyntaxHighlighter.registerLanguage("javascript", js);
12+
SyntaxHighlighter.registerLanguage("jsx", jsx);
13+
SyntaxHighlighter.registerLanguage("css", css);
714

815
const PostContent = (props) => {
916
const { slug, image, title, content } = props.post;
@@ -51,7 +58,7 @@ const PostContent = (props) => {
5158
const language = className.split("-")[1];
5259

5360
return (
54-
<SyntaxHighlighter language={language} style={dark}>
61+
<SyntaxHighlighter language={language} style={atomDark}>
5562
{children}
5663
</SyntaxHighlighter>
5764
);
Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {
3-
reactStrictMode: true,
4-
swcMinify: true,
5-
}
62

7-
module.exports = nextConfig
3+
const { PHASE_DEVELOPMENT_SERVER } = require("next/constants");
4+
5+
const nextConfig = (phase) => {
6+
const env =
7+
phase === PHASE_DEVELOPMENT_SERVER
8+
? {
9+
api: "/api/dev",
10+
}
11+
: {
12+
api: "/api/prod",
13+
};
14+
15+
return {
16+
reactStrictMode: true,
17+
swcMinify: true,
18+
env,
19+
};
20+
};
21+
22+
module.exports = nextConfig;

0 commit comments

Comments
 (0)