Skip to content

Commit 7451e98

Browse files
authored
Fix dev paths (#25)
* Fix dev paths * Remove prefix
1 parent e769c3d commit 7451e98

File tree

3 files changed

+214
-6
lines changed

3 files changed

+214
-6
lines changed

package-lock.json

Lines changed: 195 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/app/components/layout.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ import getConfig from 'next/config';
77

88
const name = 'PwrDrvr';
99
export const siteTitle = 'PwrDrvr Website - 2';
10-
const isProd = process.env.NODE_ENV === 'production';
1110

1211
export default function Layout({ children, home = undefined }) {
1312
const base = getConfig().publicRuntimeConfig.staticFolder;
1413

1514
return (
1615
<div className={styles.container}>
1716
<Head>
18-
<link rel="icon" href={`${isProd ? base : ''}/favicon.ico`} />
17+
<link rel="icon" href={`${base}/favicon.ico`} />
1918
<meta name="description" content="Learn how to build a personal website using Next.js" />
2019
<meta
2120
property="og:image"
@@ -31,7 +30,7 @@ export default function Layout({ children, home = undefined }) {
3130
<>
3231
<Image
3332
priority
34-
src={`${isProd ? base : ''}/images/profile.jpg`}
33+
src={`${base}/images/profile.jpg`}
3534
unoptimized
3635
className={utilStyles.borderCircle}
3736
height={144}
@@ -45,7 +44,7 @@ export default function Layout({ children, home = undefined }) {
4544
<Link href="/">
4645
<Image
4746
priority
48-
src={`${isProd ? base : ''}/images/profile.jpg`}
47+
src={`${base}/images/profile.jpg`}
4948
unoptimized
5049
className={utilStyles.borderCircle}
5150
height={108}

packages/app/next.config.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,24 @@ module.exports = {
5656
destination: `/_next/:path*`
5757
},
5858
{
59-
/** Images */
60-
source: `${BASE_VERSION_ONLY}/image/:query*`,
59+
/** Image optimizer (not tested yet) */
60+
source: `${BASE_VERSION_ONLY}/_next/image/:query*`,
6161
destination: `/_next/image/:query*`
6262
},
63+
{
64+
// Images
65+
// Only used for local development
66+
// On deployed environments, the images are served from S3
67+
// and image requests will never reach this rewrite
68+
source: `${BASE_VERSION_ONLY}/images/:query*`,
69+
destination: `/images/:query*`
70+
},
71+
{
72+
// Favicon
73+
// Only used for local development
74+
source: `${BASE_VERSION_ONLY}/favicon.ico`,
75+
destination: `/favicon.ico`
76+
},
6377
/** Api Calls */
6478
{
6579
source: `${BASE_VERSION_ONLY}/api/:path*`,

0 commit comments

Comments
 (0)