2023-11-29 20:29:25 +03:00
|
|
|
/** @file Configuration for vite. */
|
2024-01-10 19:22:11 +03:00
|
|
|
import * as url from 'node:url'
|
|
|
|
|
2023-11-29 20:29:25 +03:00
|
|
|
import vitePluginYaml from '@modyfi/vite-plugin-yaml'
|
2024-01-10 19:22:11 +03:00
|
|
|
import vitePluginReact from '@vitejs/plugin-react'
|
|
|
|
import * as vite from 'vite'
|
2023-11-29 20:29:25 +03:00
|
|
|
|
2024-01-31 14:35:41 +03:00
|
|
|
import * as common from 'enso-common'
|
|
|
|
|
2023-11-29 20:29:25 +03:00
|
|
|
// =================
|
|
|
|
// === Constants ===
|
|
|
|
// =================
|
|
|
|
|
|
|
|
const SERVER_PORT = 8080
|
|
|
|
|
|
|
|
// =====================
|
|
|
|
// === Configuration ===
|
|
|
|
// =====================
|
|
|
|
|
|
|
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
|
|
|
|
|
|
export default vite.defineConfig({
|
2024-01-31 14:35:41 +03:00
|
|
|
server: { port: SERVER_PORT, headers: Object.fromEntries(common.COOP_COEP_CORP_HEADERS) },
|
2024-02-12 13:05:30 +03:00
|
|
|
plugins: [
|
|
|
|
vitePluginReact({
|
|
|
|
include: '**/*.tsx',
|
|
|
|
babel: {
|
|
|
|
plugins: ['@babel/plugin-syntax-import-assertions'],
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
vitePluginYaml(),
|
|
|
|
],
|
2024-01-10 19:22:11 +03:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'#': url.fileURLToPath(new URL('./src', import.meta.url)),
|
2023-11-29 20:29:25 +03:00
|
|
|
},
|
2024-01-23 00:26:15 +03:00
|
|
|
},
|
2024-01-31 14:35:41 +03:00
|
|
|
build: {
|
|
|
|
rollupOptions: {
|
|
|
|
input: {
|
|
|
|
main: url.fileURLToPath(new URL('./index.html', import.meta.url)),
|
|
|
|
'404': url.fileURLToPath(new URL('./404.html', import.meta.url)),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-11-29 20:29:25 +03:00
|
|
|
define: {
|
|
|
|
IS_VITE: JSON.stringify(true),
|
|
|
|
REDIRECT_OVERRIDE: JSON.stringify(`http://localhost:${SERVER_PORT}`),
|
|
|
|
CLOUD_ENV:
|
|
|
|
process.env.ENSO_CLOUD_ENV != null ? JSON.stringify(process.env.ENSO_CLOUD_ENV) : 'undefined',
|
|
|
|
// Single hardcoded usage of `global` in by aws-amplify.
|
|
|
|
'global.TYPED_ARRAY_SUPPORT': JSON.stringify(true),
|
2024-01-23 00:26:15 +03:00
|
|
|
},
|
2023-11-29 20:29:25 +03:00
|
|
|
})
|