chore: use config settings in vite dev server
This commit is contained in:
parent
9a8546ef09
commit
4f7ba383e6
@ -5,6 +5,7 @@ import { reactRouterHonoServer } from 'react-router-hono-server/dev';
|
|||||||
import tailwindcss from 'tailwindcss';
|
import tailwindcss from 'tailwindcss';
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import tsconfigPaths from 'vite-tsconfig-paths';
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
||||||
|
import { parse } from 'yaml';
|
||||||
|
|
||||||
const prefix = process.env.__INTERNAL_PREFIX || '/admin';
|
const prefix = process.env.__INTERNAL_PREFIX || '/admin';
|
||||||
if (prefix.endsWith('/')) {
|
if (prefix.endsWith('/')) {
|
||||||
@ -18,9 +19,17 @@ if (!version) {
|
|||||||
throw new Error('Unable to read version from package.json');
|
throw new Error('Unable to read version from package.json');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load the config without any environment variables (not needed here)
|
||||||
|
const config = await readFile('config.example.yaml', 'utf-8');
|
||||||
|
const { server } = parse(config);
|
||||||
|
|
||||||
export default defineConfig(({ isSsrBuild }) => ({
|
export default defineConfig(({ isSsrBuild }) => ({
|
||||||
base: isSsrBuild ? `${prefix}/` : undefined,
|
base: isSsrBuild ? `${prefix}/` : undefined,
|
||||||
plugins: [reactRouterHonoServer(), reactRouter(), tsconfigPaths()],
|
plugins: [reactRouterHonoServer(), reactRouter(), tsconfigPaths()],
|
||||||
|
server: {
|
||||||
|
host: server.host,
|
||||||
|
port: server.port,
|
||||||
|
},
|
||||||
css: {
|
css: {
|
||||||
postcss: {
|
postcss: {
|
||||||
plugins: [tailwindcss, autoprefixer],
|
plugins: [tailwindcss, autoprefixer],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user