@@ -5,7 +5,7 @@ import { defineConfig, loadEnv } from "vite";
55import { minify } from "terser" ;
66import vue from "@vitejs/plugin-vue2" ;
77import { viteStaticCopy } from "vite-plugin-static-copy" ;
8- import kirby from "./scripts/vite-kirby.mjs " ;
8+ import kirby from "./scripts/vite-kirby" ;
99import postcssLightDarkFunction from "@csstools/postcss-light-dark-function" ;
1010
1111/**
@@ -28,7 +28,7 @@ function createAliases(proxy) {
2828/**
2929 * Returns the server configuration
3030 */
31- function createServer ( proxy ) {
31+ async function createServer ( proxy ) {
3232 return {
3333 allowedHosts : [ proxy . target . substring ( 8 ) ] ,
3434 cors : { origin : proxy . target } ,
@@ -39,16 +39,17 @@ function createServer(proxy) {
3939 } ,
4040 open : proxy . target + "/panel" ,
4141 port : 3000 ,
42- ...createCustomServer ( )
42+ ...( await createCustomServer ( ) )
4343 } ;
4444}
4545
4646/**
4747 * Returns custom server configuration, if it exists
4848 */
49- function createCustomServer ( ) {
49+ async function createCustomServer ( ) {
5050 try {
51- return require ( "./vite.config.custom.js" ) ;
51+ const module = await import ( "./vite.config.custom.js" ) ;
52+ return module . default ?? { } ;
5253 } catch {
5354 return { } ;
5455 }
@@ -114,7 +115,7 @@ function createTest() {
114115/**
115116 * Returns the Vite configuration
116117 */
117- export default defineConfig ( ( { mode } ) => {
118+ export default defineConfig ( async ( { mode } ) => {
118119 // Load env file based on `mode` in the current working directory.
119120 // Set the third parameter to '' to load all env regardless of the `VITE_` prefix.
120121 process . env = {
@@ -168,7 +169,7 @@ export default defineConfig(({ mode }) => {
168169 resolve : {
169170 alias : createAliases ( proxy )
170171 } ,
171- server : createServer ( proxy ) ,
172+ server : await createServer ( proxy ) ,
172173 test : createTest ( )
173174 } ;
174175} ) ;
0 commit comments