Created
February 22, 2023 08:58
-
-
Save dkesberg/4e87216a768963f15ed1f6c276a0c2b5 to your computer and use it in GitHub Desktop.
Vue JS subdirectory setup for /directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VITE_BASE="/directory/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase /directory/ | |
RewriteRule ^directory/index\.html$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /directory/index.html [L] | |
</IfModule> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { fileURLToPath, URL } from "node:url"; | |
import { defineConfig, loadEnv } from "vite"; | |
import vue from "@vitejs/plugin-vue"; | |
// https://vitejs.dev/config/ | |
export default defineConfig(({ command, mode }) => { | |
const env = loadEnv(mode, process.cwd(), ''); | |
const base = env.VITE_BASE || '/'; | |
return { | |
plugins: [vue()], | |
base: base, | |
resolve: { | |
alias: { | |
'@': fileURLToPath(new URL('./src', import.meta.url)) | |
} | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment