Add 'frontend/' from commit 'c070c0315d66a44154ab7d9f9ea6c211a15f4dba'
git-subtree-dir: frontend git-subtree-mainline:205a3bd14bgit-subtree-split:c070c0315d
This commit is contained in:
34
frontend/vite.config.js
Normal file
34
frontend/vite.config.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import {fileURLToPath, URL} from 'node:url'
|
||||
import {defineConfig, loadEnv} from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import svgLoader from 'vite-svg-loader'
|
||||
import fs from 'fs';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(({mode}) => {
|
||||
// Load environment variables based on the mode
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
return {
|
||||
plugins: [
|
||||
vue(),
|
||||
svgLoader()
|
||||
],
|
||||
server: {
|
||||
https: {
|
||||
key: fs.readFileSync('localhost-key.pem'),
|
||||
cert: fs.readFileSync('localhost.pem'),
|
||||
},
|
||||
host: 'localhost',
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
}
|
||||
},
|
||||
define: {
|
||||
// Define a global constant __APP_ENV__ based on loaded environment variables
|
||||
VITE_API_URL: JSON.stringify(env.VITE_API_URL),
|
||||
VITE_STRIPE_API_KEY: JSON.stringify(env.VITE_STRIPE_API_KEY)
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user