Skip to content

Commit 8a2ecec

Browse files
committed
refactor: create common asset
1 parent fdf32f5 commit 8a2ecec

7 files changed

Lines changed: 2273 additions & 79 deletions

File tree

module/app/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
},
1010
"devDependencies": {
1111
"typescript": "^5.5.3",
12-
"vite": "^5.4.1"
12+
"vite": "^5.4.1",
13+
"vite-plugin-static-copy": "^1.0.6"
1314
},
1415
"dependencies": {
16+
"@fontsource/jetbrains-mono": "^5.1.0",
1517
"pixi.js": "^8.4.1"
1618
}
1719
}

module/asset/logo.svg

Lines changed: 104 additions & 0 deletions
Loading

module/site/next.config.mjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,32 @@ const nextConfig = {
2121
unoptimized: true,
2222
},
2323
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'mdx'],
24+
webpack(config) {
25+
// Grab the existing rule that handles SVG imports
26+
// @ts-ignore - this is a private property that is not typed
27+
const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.('.svg'));
28+
29+
config.module.rules.push(
30+
// Reapply the existing rule, but only for svg imports ending in ?url
31+
{
32+
...fileLoaderRule,
33+
test: /\.svg$/i,
34+
resourceQuery: /url/, // *.svg?url
35+
},
36+
// Convert all other *.svg imports to React components
37+
{
38+
test: /\.svg$/i,
39+
issuer: fileLoaderRule.issuer,
40+
resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] }, // exclude if *.svg?url
41+
use: ['@svgr/webpack'],
42+
}
43+
);
44+
45+
// Modify the file loader rule to ignore *.svg, since we have it handled now.
46+
fileLoaderRule.exclude = /\.svg$/i;
47+
48+
return config;
49+
},
2450
}
2551

2652
export default withMDX(nextConfig)

module/site/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"unist-util-visit": "^5.0.0"
3939
},
4040
"devDependencies": {
41+
"@svgr/webpack": "^8.1.0",
4142
"@types/mdx": "^2.0.13",
4243
"eslint": "^8.56.0",
4344
"eslint-config-next": "^14.0.4",

module/site/src/components/Layout.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { useId } from 'react'
22

33
import { Intro, IntroFooter } from '@/components/Intro'
4-
import { StarField } from '@/components/StarField'
54
import { ThemeToggle } from '@/components/ThemeToggle'
65

7-
import bg from '../images/background.jpg'
6+
import bg from '../../../asset/background.jpg'
87

98
function Timeline() {
109
let id = useId()

0 commit comments

Comments
 (0)