2022-11-24 14:46:29 +01:00
|
|
|
import {fileURLToPath, URL} from 'node:url'
|
|
|
|
|
|
|
|
import {defineConfig} from 'vite'
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig(({command, mode, ssrBuild}) => {
|
|
|
|
const ret = {
|
|
|
|
plugins: [vue()],
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
if (command === 'serve') {
|
|
|
|
ret.define = {
|
|
|
|
"__API_URL__": JSON.stringify("http://localhost:3000"),
|
|
|
|
};
|
2022-12-23 01:17:03 +01:00
|
|
|
} else if (mode === 'embedded') {
|
|
|
|
ret.define = {
|
|
|
|
"__API_URL__": JSON.stringify("/"),
|
|
|
|
};
|
2022-11-24 14:46:29 +01:00
|
|
|
} else {
|
|
|
|
ret.define = {
|
2022-12-22 16:28:15 +01:00
|
|
|
"__API_URL__": JSON.stringify("http://localhost:3000"),
|
2022-11-24 14:46:29 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
})
|