Skip to content

Commit

Permalink
feat: add vite missing base prop when doing the build
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmahidalgo committed Nov 25, 2024
1 parent c2d731d commit 88eb223
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
import { defineConfig, loadEnv } from "vite"
import svgr from "vite-plugin-svgr"

// https://vitejs.dev/config/
// eslint-disable-next-line import/no-default-export
export default defineConfig({
plugins: [react(), svgr()],
export default defineConfig(({ command, mode }) => {
const envVariables = loadEnv(mode, process.cwd())
return {
plugins: [react(), svgr()],
...(command === "build" ? { base: envVariables.VITE_BASE_URL } : undefined),
}
})

0 comments on commit 88eb223

Please sign in to comment.