ui: fix VITE_PUBLIC_SERVER variable reading (#24845)
This commit is contained in:
@@ -10,10 +10,9 @@ import { SvelteKitPWA } from '@vite-pwa/sveltekit';
|
|||||||
import { playwright } from '@vitest/browser-playwright';
|
import { playwright } from '@vitest/browser-playwright';
|
||||||
import { dirname, resolve } from 'path';
|
import { dirname, resolve } from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import { defineConfig, searchForWorkspaceRoot } from 'vite';
|
import { defineConfig, loadEnv, searchForWorkspaceRoot } from 'vite';
|
||||||
|
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
const SERVER_ORIGIN = import.meta.env?.VITE_PUBLIC_SERVER_ORIGIN || 'http://localhost:8080';
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const browserBaseConfig: any = {
|
const browserBaseConfig: any = {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
@@ -25,7 +24,11 @@ const browserBaseConfig: any = {
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig(({ mode }) => {
|
||||||
|
const env = loadEnv(mode, process.cwd(), 'VITE_PUBLIC_');
|
||||||
|
const SERVER_ORIGIN = env.VITE_PUBLIC_SERVER_ORIGIN || 'http://localhost:8080';
|
||||||
|
|
||||||
|
return {
|
||||||
build: {
|
build: {
|
||||||
assetsInlineLimit: 32000,
|
assetsInlineLimit: 32000,
|
||||||
chunkSizeWarningLimit: 3072,
|
chunkSizeWarningLimit: 3072,
|
||||||
@@ -101,4 +104,5 @@ export default defineConfig({
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user