Skip to content

Commit

Permalink
get Parcel to render images correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Grazia Palombella committed Dec 22, 2022
1 parent 64ee97b commit 2ec5c74
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ dist/
.vscode/
src/design/
src/images/
static/
TODO.md
4 changes: 4 additions & 0 deletions .parcelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "@parcel/config-default",
"reporters": ["...", "parcel-reporter-static-files-copy"]
}
36 changes: 36 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@parcel/config-default": "^2.8.2",
"@types/node": "^18.11.17",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9",
"@types/redux-logger": "^3.0.9",
Expand All @@ -25,6 +27,7 @@
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-typescript": "^0.14.0",
"parcel": "^2.8.0",
"parcel-reporter-static-files-copy": "^1.4.0",
"prettier": "^2.8.0",
"process": "^0.11.10",
"redux-devtools-extension": "^2.13.9"
Expand Down
5 changes: 4 additions & 1 deletion src/components/User.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ interface UserProps {

const User = (props: UserProps) => {
return (
<div>{props.user.username}</div>
<div>
<img src={`./image-${props.user.username}.png`} alt={props.user.username}/>
{props.user.username}
</div>
)
}

Expand Down

0 comments on commit 2ec5c74

Please sign in to comment.