Skip to content

Commit 2a0f5a5

Browse files
committed
chore(env): rename env and adjust loading style
1 parent 4c3dd86 commit 2a0f5a5

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
NEXT_PUBLIC_SITE_HOST=https://example.com
2-
NEXT_PUBLIC_SITE_DOMAIN=example.com
2+
NEXT_PUBLIC_IMAGE_DOMAIN=example.com
33

44
# http 无法访问 https,也可使用 next dev --experimental-https 生成证书
55
NODE_TLS_REJECT_UNAUTHORIZED=0

app/post/[slug]/loading.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default function Loading() {
22
return (
3-
<div className="mt-16 flex flex-col items-center justify-center space-y-2">
3+
<div className="my-16 flex flex-col items-center justify-center space-y-2">
44
<div className="inline-block size-12 animate-spin rounded-full border-[3px] border-t-slate-400"></div>
55
<span>Loading...</span>
66
</div>

next.config.ts

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
import type { NextConfig } from 'next';
2+
import type { RemotePattern } from 'next/dist/shared/lib/image-config';
3+
4+
const imageRemotes: RemotePattern[] = [
5+
'testingcf.jsdelivr.net',
6+
'cdn.jsdelivr.net',
7+
process.env.NEXT_PUBLIC_IMAGE_DOMAIN || '',
8+
].map((hostname) => ({
9+
protocol: 'https',
10+
hostname,
11+
port: '',
12+
pathname: '/**',
13+
}));
214

315
const nextConfig: NextConfig = {
416
output: 'standalone',
@@ -7,26 +19,7 @@ const nextConfig: NextConfig = {
719
// https://github.com/hashicorp/next-mdx-remote?tab=readme-ov-file#installation
820
transpilePackages: ['next-mdx-remote'],
921
images: {
10-
remotePatterns: [
11-
{
12-
protocol: 'https',
13-
hostname: 'testingcf.jsdelivr.net',
14-
port: '',
15-
pathname: '/**',
16-
},
17-
{
18-
protocol: 'https',
19-
hostname: 'cdn.jsdelivr.net',
20-
port: '',
21-
pathname: '/**',
22-
},
23-
{
24-
protocol: 'https',
25-
hostname: process.env.NEXT_PUBLIC_SITE_DOMAIN || '',
26-
port: '',
27-
pathname: '/**',
28-
},
29-
],
22+
remotePatterns: imageRemotes,
3023
},
3124
async headers() {
3225
return [

0 commit comments

Comments
 (0)