2023-09-05 01:27:33 +03:00
|
|
|
import vue from '@vitejs/plugin-vue'
|
2023-09-22 06:43:25 +03:00
|
|
|
import { fileURLToPath } from 'node:url'
|
2023-09-05 01:27:33 +03:00
|
|
|
import postcssNesting from 'postcss-nesting'
|
2023-09-22 06:43:25 +03:00
|
|
|
import tailwindcss from 'tailwindcss'
|
|
|
|
import tailwindcssNesting from 'tailwindcss/nesting'
|
2023-10-07 23:57:47 +03:00
|
|
|
import { defineConfig, type Plugin } from 'vite'
|
2023-09-20 12:16:18 +03:00
|
|
|
import topLevelAwait from 'vite-plugin-top-level-await'
|
2023-09-22 06:43:25 +03:00
|
|
|
import * as tailwindConfig from '../ide-desktop/lib/dashboard/tailwind.config'
|
|
|
|
import { createGatewayServer } from './ydoc-server'
|
|
|
|
const projectManagerUrl = 'ws://127.0.0.1:30535'
|
2023-09-05 01:27:33 +03:00
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
2023-09-22 06:43:25 +03:00
|
|
|
cacheDir: '../../node_modules/.cache/vite',
|
|
|
|
plugins: [vue(), gatewayServer(), topLevelAwait()],
|
|
|
|
optimizeDeps: {
|
|
|
|
entries: 'index.html',
|
|
|
|
},
|
2023-09-05 01:27:33 +03:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
2023-09-07 15:54:01 +03:00
|
|
|
shared: fileURLToPath(new URL('./shared', import.meta.url)),
|
2023-10-16 18:56:24 +03:00
|
|
|
'rust-ffi': fileURLToPath(new URL('./rust-ffi', import.meta.url)),
|
2023-09-05 01:27:33 +03:00
|
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
|
|
},
|
|
|
|
},
|
2023-09-22 06:43:25 +03:00
|
|
|
define: {
|
|
|
|
REDIRECT_OVERRIDE: JSON.stringify('http://localhost:8080'),
|
|
|
|
PROJECT_MANAGER_URL: JSON.stringify(projectManagerUrl),
|
|
|
|
IS_DEV_MODE: JSON.stringify(process.env.NODE_ENV !== 'production'),
|
2023-10-02 12:03:47 +03:00
|
|
|
CLOUD_ENV:
|
|
|
|
process.env.ENSO_CLOUD_ENV != null ? JSON.stringify(process.env.ENSO_CLOUD_ENV) : 'undefined',
|
2023-10-11 16:04:38 +03:00
|
|
|
RUNNING_VITEST: false,
|
2023-10-07 23:57:47 +03:00
|
|
|
'import.meta.vitest': false,
|
|
|
|
// Single hardcoded usage of `global` in by aws-amplify.
|
|
|
|
'global.TYPED_ARRAY_SUPPORT': true,
|
2023-09-22 06:43:25 +03:00
|
|
|
},
|
|
|
|
assetsInclude: ['**/*.yaml', '**/*.svg'],
|
2023-09-05 01:27:33 +03:00
|
|
|
css: {
|
|
|
|
postcss: {
|
2023-09-22 06:43:25 +03:00
|
|
|
plugins: [tailwindcssNesting(postcssNesting()), tailwindcss({ config: tailwindConfig })],
|
2023-09-05 01:27:33 +03:00
|
|
|
},
|
|
|
|
},
|
2023-09-22 06:43:25 +03:00
|
|
|
build: {
|
|
|
|
// dashboard chunk size is larger than the default warning limit
|
|
|
|
chunkSizeWarningLimit: 700,
|
2023-10-07 23:57:47 +03:00
|
|
|
rollupOptions: {
|
|
|
|
output: {
|
|
|
|
manualChunks: {
|
|
|
|
fontawesome: ['@fortawesome/react-fontawesome', '@fortawesome/free-brands-svg-icons'],
|
|
|
|
'aws-amplify': ['@aws-amplify/core', '@aws-amplify/auth'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-09-22 06:43:25 +03:00
|
|
|
},
|
2023-09-05 01:27:33 +03:00
|
|
|
})
|
|
|
|
|
2023-09-22 06:43:25 +03:00
|
|
|
function gatewayServer(): Plugin {
|
2023-09-05 01:27:33 +03:00
|
|
|
return {
|
2023-09-22 06:43:25 +03:00
|
|
|
name: 'gateway-server',
|
2023-09-05 01:27:33 +03:00
|
|
|
configureServer(server) {
|
|
|
|
if (server.httpServer == null) return
|
2023-09-22 06:43:25 +03:00
|
|
|
|
|
|
|
createGatewayServer(server.httpServer)
|
2023-09-05 01:27:33 +03:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|