Skip to content

Commit

Permalink
Set up a new env var VITE_PUBLIC_URL
Browse files Browse the repository at this point in the history
  • Loading branch information
alifeinbinary committed Oct 4, 2024
1 parent 0fbc266 commit 2e47275
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/Post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const Post: React.FC<PostProps> = ({ id, entryId, author, posted, image, width,
<div className="grid w-40">
<div className="relative">
<label htmlFor="post-link" className="sr-only">
ID:<Link to={import.meta.env.BASE_URL + "#/" + entryId} className="mx-2 hover:underline">{entryId}</Link>
ID:<Link to={import.meta.env.VITE_PUBLIC_URL + "#/" + entryId} className="mx-2 hover:underline">{entryId}</Link>
</label>
<input
id="post-link"
Expand All @@ -148,7 +148,7 @@ const Post: React.FC<PostProps> = ({ id, entryId, author, posted, image, width,
readOnly
onClick={handleLinkClick}
/>
<Clipboard.WithIconText label="Copy link" icon={LinkIcon} className="py-1 dark:bg-gray-600 bg-gray-300 hover:bg-gray-200" valueToCopy={`${import.meta.env.BASE_URL}#/${entryId}`} />
<Clipboard.WithIconText label="Copy link" icon={LinkIcon} className="py-1 dark:bg-gray-600 bg-gray-300 hover:bg-gray-200" valueToCopy={`${import.meta.env.VITE_PUBLIC_URL}#/${entryId}`} />
</div>
</div>
</span>
Expand Down
2 changes: 1 addition & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ let router = createBrowserRouter(
errorElement: <Error />
}
],
{ basename: import.meta.env.BASE_URL }
{ basename: import.meta.env.VITE_PUBLIC_URL }
);
createRoot(document.getElementById('root')!).render(
<StrictMode>
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default defineConfig(({ mode }) => {
}),
purgeCss(),
],
base: mode === "production" ? "stegg.alifeinbinary.com/" : "/",
base: mode === "production" ? "/" : "/",
build: {
assetsDir: "public",
sourcemap: true,
Expand Down

0 comments on commit 2e47275

Please sign in to comment.