diff --git a/packages/compiler/src/build/client-config.ts b/packages/compiler/src/build/client-config.ts index 5a47ceae..94985d63 100644 --- a/packages/compiler/src/build/client-config.ts +++ b/packages/compiler/src/build/client-config.ts @@ -75,7 +75,11 @@ export async function clientBuildConfig(dirname: string, options: ClientBuildCon let serverUrl = '' - serverUrl = env.VITE_SERVER_URL = process.env.VITE_SERVER_URL ?? buildOptions?.serverUrl ?? '' + let envServerUrl = process.env.VITE_SERVER_URL + if (envServerUrl && !envServerUrl.startsWith('http')) { + process.env.VITE_SERVER_URL = envServerUrl = `http://${envServerUrl}` + } + serverUrl = env.VITE_SERVER_URL = envServerUrl ?? buildOptions?.serverUrl ?? '' if (options.mode != 'test' && !plugin && !libMode) { // if index.html is not found, display an error diff --git a/packages/compiler/src/build/vite-plugin-config.toml.ts b/packages/compiler/src/build/vite-plugin-config.toml.ts index b88ca88b..a183eada 100644 --- a/packages/compiler/src/build/vite-plugin-config.toml.ts +++ b/packages/compiler/src/build/vite-plugin-config.toml.ts @@ -148,7 +148,7 @@ export function loadServerFiles(modulePath: string, options, config) { const eventsFilesString = searchFolderAndTransformToImportString('events', modulePath, '.ts') const hitbox = config.start?.hitbox - const verifyDefaultExport = (importObject: ImportObject) => ` + const verifyDefaultExport = (importObject: ImportObject) => dd` [${importObject?.variablesString}].map((val) => { if (!val) { throw new Error('Do you have "export default" in this file ? : ${importObject?.relativePath}') diff --git a/packages/compiler/tests/toml.spec.ts b/packages/compiler/tests/toml.spec.ts index 2d470c6f..0258af5b 100644 --- a/packages/compiler/tests/toml.spec.ts +++ b/packages/compiler/tests/toml.spec.ts @@ -202,6 +202,7 @@ describe('TOML Configuration test', () => { expect(result).toEqual({ variablesString: '', importString: '', + relativePath: '', folder: '', }) })