Automatically configure default preload URL if the backend serves the frontend directly.

Fixes #207
This commit is contained in:
Yeicor
2024-11-15 22:56:34 +01:00
parent ea181dac0b
commit 4343c52466
7 changed files with 195 additions and 63 deletions

View File

@@ -5,6 +5,7 @@ import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import {name, version} from './package.json'
import {execSync} from 'child_process'
import topLevelAwait from "vite-plugin-top-level-await";
// https://vitejs.dev/config/
export default defineConfig({
@@ -18,6 +19,12 @@ export default defineConfig({
}
}),
vueJsx(),
topLevelAwait({
// The export name of top-level await promise for each chunk module
promiseExportName: "__tla",
// The function to generate import names of top-level await promise in each chunk module
promiseImportName: i => `__tla_${i}`
}),
],
resolve: {
alias: {