Skip to content

Commit d6b3504

Browse files
YarnUrlStuff
1 parent 408b50f commit d6b3504

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
"resize-toolbox-images": "node ./bin/resize-toolbox-images.mjs"
1111
},
1212
"dependencies": {
13+
"path": "^0.12.7",
1314
"react": "^17.0.2",
1415
"react-dom": "^17.0.2",
1516
"react-router-dom": "^6.27.0",
16-
"shadertoy-react": "^1.1.2"
17+
"shadertoy-react": "^1.1.2",
18+
"url": "^0.11.4"
1719
},
1820
"devDependencies": {
1921
"@monaco-editor/react": "^4.3.1",

src/Pages/ProjectsPage/PGASGame.tsx

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
import { Paragraph } from "../../Components/Paragraph";
22

3-
import LevelsSS from "../../assets/PGAS24_LevelsSS.png";
4-
import MainMenuSS from "../../assets/PGAS24_MainMenuSS.png";
5-
import PowerupSS from "../../assets/PGAS24_PowerupSS.png";
6-
import WarningSS from "../../assets/PGAS24_WarningSS.png";
3+
import LevelsSS from "@assets/PGAS24_LevelsSS.png";
4+
import MainMenuSS from "@assets/PGAS24_MainMenuSS.png";
5+
import PowerupSS from "@assets/PGAS24_PowerupSS.png";
6+
import WarningSS from "@assets/PGAS24_WarningSS.png";
77

88
export default function PGASGame(){
9-
function getImageUrl(file: string) {
10-
// note that this does not include files in subdirectories
11-
return new URL(`${file}`, import.meta.url).href
12-
}
13-
149
return <div className="relative grid place-items-center">
1510
<article className="my-4 p-2 w-full max-w-sm md:max-w-2xl">
1611
<h1 className="text-4xl">PGAS-Game</h1>
@@ -40,10 +35,10 @@ export default function PGASGame(){
4035

4136
<h2 className="text-xl">Images</h2>
4237
<div className="grid gap-1 grid-cols-1 md:grid-cols-2">
43-
<img src={getImageUrl(LevelsSS)} alt="LevelSS.png"/>
44-
<img src={getImageUrl(MainMenuSS)} alt="MainMenuSS.png"/>
45-
<img src={getImageUrl(PowerupSS)} alt="PowerupSS.png"/>
46-
<img src={getImageUrl(WarningSS)} alt="WarningSS.png"/>
38+
<img src={LevelsSS} alt="LevelSS.png"/>
39+
<img src={MainMenuSS} alt="MainMenuSS.png"/>
40+
<img src={PowerupSS} alt="PowerupSS.png"/>
41+
<img src={WarningSS} alt="WarningSS.png"/>
4742
</div>
4843
</article>
4944
</div>

vite.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
import { defineConfig } from 'vite'
22
import react from '@vitejs/plugin-react'
3+
import * as path from "path";
4+
import { fileURLToPath } from 'url';
5+
6+
const __dirname = fileURLToPath(new URL('.', import.meta.url));
37

48
// https://vitejs.dev/config/
59
export default defineConfig({
610
plugins: [react()],
711
assetsInclude: ['**/*.PNG'],
12+
13+
resolve: {
14+
alias: {
15+
"@assets": path.resolve(__dirname, "src/assets"),
16+
},
17+
},
818
})

0 commit comments

Comments
 (0)