diff options
Diffstat (limited to 'subprojects/frontend/vite.config.ts')
-rw-r--r-- | subprojects/frontend/vite.config.ts | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/subprojects/frontend/vite.config.ts b/subprojects/frontend/vite.config.ts index 1059ed2f..e690d005 100644 --- a/subprojects/frontend/vite.config.ts +++ b/subprojects/frontend/vite.config.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | import { setDefaultResultOrder } from 'node:dns'; | ||
1 | import { readFileSync } from 'node:fs'; | 2 | import { readFileSync } from 'node:fs'; |
2 | import path from 'node:path'; | 3 | import path from 'node:path'; |
3 | import { fileURLToPath } from 'node:url'; | 4 | import { fileURLToPath } from 'node:url'; |
@@ -9,6 +10,8 @@ import { defineConfig, PluginOption } from 'vite'; | |||
9 | import injectPreload from 'vite-plugin-inject-preload'; | 10 | import injectPreload from 'vite-plugin-inject-preload'; |
10 | import { VitePWA } from 'vite-plugin-pwa'; | 11 | import { VitePWA } from 'vite-plugin-pwa'; |
11 | 12 | ||
13 | setDefaultResultOrder('verbatim'); | ||
14 | |||
12 | const thisDir = path.dirname(fileURLToPath(import.meta.url)); | 15 | const thisDir = path.dirname(fileURLToPath(import.meta.url)); |
13 | 16 | ||
14 | const mode = process.env.MODE || 'development'; | 17 | const mode = process.env.MODE || 'development'; |
@@ -22,7 +25,7 @@ function portNumberOrElse(envName: string, fallback: number): number { | |||
22 | 25 | ||
23 | const listenHost = process.env.LISTEN_HOST || 'localhost'; | 26 | const listenHost = process.env.LISTEN_HOST || 'localhost'; |
24 | const listenPort = portNumberOrElse('LISTEN_PORT', 1313); | 27 | const listenPort = portNumberOrElse('LISTEN_PORT', 1313); |
25 | const apiHost = process.env.API_HOST || listenHost; | 28 | const apiHost = process.env.API_HOST || '127.0.0.1'; |
26 | const apiPort = portNumberOrElse('API_PORT', 1312); | 29 | const apiPort = portNumberOrElse('API_PORT', 1312); |
27 | const apiSecure = apiPort === 443; | 30 | const apiSecure = apiPort === 443; |
28 | const publicHost = process.env.PUBLIC_HOST || listenHost; | 31 | const publicHost = process.env.PUBLIC_HOST || listenHost; |
@@ -60,15 +63,7 @@ export default defineConfig({ | |||
60 | cacheDir: path.join(thisDir, 'build/vite/cache'), | 63 | cacheDir: path.join(thisDir, 'build/vite/cache'), |
61 | plugins: [ | 64 | plugins: [ |
62 | minifyPlugin, | 65 | minifyPlugin, |
63 | react({ | 66 | react(), |
64 | babel: { | ||
65 | // Gets rid of deoptimization warnings for large chunks. | ||
66 | // We don't need to minify here, because the output of Babel | ||
67 | // will get passed to esbuild anyways. | ||
68 | compact: false, | ||
69 | minified: false, | ||
70 | }, | ||
71 | }), | ||
72 | injectPreload({ | 67 | injectPreload({ |
73 | files: [ | 68 | files: [ |
74 | { | 69 | { |
@@ -87,12 +82,6 @@ export default defineConfig({ | |||
87 | strategies: 'generateSW', | 82 | strategies: 'generateSW', |
88 | registerType: 'prompt', | 83 | registerType: 'prompt', |
89 | injectRegister: null, | 84 | injectRegister: null, |
90 | devOptions: { | ||
91 | enabled: true, | ||
92 | }, | ||
93 | // Unregister service worker installed in production mode | ||
94 | // if Vite is started in development mode on the same domain. | ||
95 | selfDestroying: isDevelopment, | ||
96 | workbox: { | 85 | workbox: { |
97 | globPatterns: [ | 86 | globPatterns: [ |
98 | '**/*.{css,html,js}', | 87 | '**/*.{css,html,js}', |
@@ -101,7 +90,6 @@ export default defineConfig({ | |||
101 | ], | 90 | ], |
102 | dontCacheBustURLsMatching: /\.(?:css|js|woff2?)$/, | 91 | dontCacheBustURLsMatching: /\.(?:css|js|woff2?)$/, |
103 | navigateFallbackDenylist: [/^\/xtext-service/], | 92 | navigateFallbackDenylist: [/^\/xtext-service/], |
104 | sourcemap: isDevelopment, | ||
105 | }, | 93 | }, |
106 | includeAssets: ['apple-touch-icon.png', 'favicon.svg', 'mask-icon.svg'], | 94 | includeAssets: ['apple-touch-icon.png', 'favicon.svg', 'mask-icon.svg'], |
107 | manifest: { | 95 | manifest: { |