- Move remaining beach packages and embedded admin assets\n- Rewrite framework, example, build, and gate paths
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import { defineConfig, type Plugin } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
|
|
// The committed build is path-agnostic (D-02): assets use a relative base and
|
|
// index.html keeps the __SUMMER_ADMIN_BASE__ token, which the Go server
|
|
// (boardwalk) replaces with the configured backend.uri. The dev server
|
|
// replaces it with SUMMER_ADMIN_DEV_PREFIX and proxies the admin API to a
|
|
// running `summer serve` at SUMMER_ADMIN_DEV_TARGET.
|
|
const devPrefix = (process.env.SUMMER_ADMIN_DEV_PREFIX ?? '/backend').replace(/\/+$/, '')
|
|
const devTarget = process.env.SUMMER_ADMIN_DEV_TARGET ?? 'http://localhost:8080'
|
|
|
|
function devBase(): Plugin {
|
|
return {
|
|
name: 'summer-admin-dev-base',
|
|
apply: 'serve',
|
|
transformIndexHtml: (html) => html.replace('__SUMMER_ADMIN_BASE__', devPrefix),
|
|
}
|
|
}
|
|
|
|
export default defineConfig(({ command }) => ({
|
|
base: command === 'build' ? './' : '/',
|
|
plugins: [vue(), tailwindcss(), devBase()],
|
|
build: {
|
|
outDir: '../modules/boardwalk/dist',
|
|
emptyOutDir: true,
|
|
sourcemap: false,
|
|
},
|
|
server: {
|
|
proxy: {
|
|
[`${devPrefix}/api`]: { target: devTarget, changeOrigin: false },
|
|
},
|
|
},
|
|
}))
|