enso/app/ide-desktop/lib/dashboard/vite.config.ts
somebody1234 d2f6b1026a
Refactor configuration keys out of repository (#8895)
- Close https://github.com/enso-org/cloud-v2/issues/866
- Remove *all* references to client keys and API base URLs from the codebase.
- The app can still be built by external contributors. *However*, the cloud backend (among some other things) will be completely disabled, as the required keys and base URLs will be missing.
- Add entry to `.gitignore` to allow `*.env` files in `app/ide-desktop/lib/dashboard/`

# Important Notes
- Tested (no `.env`; `.env` with prod backend; `.pbuchu.env`) on:
- `npm run dev` in `app/ide-desktop/lib/dashboard/`
- `./run ide build`
- `./run ide2 build`
- `./run gui watch`
2024-03-08 03:14:26 +00:00

48 lines
1.3 KiB
TypeScript

/** @file Configuration for vite. */
import * as url from 'node:url'
import vitePluginYaml from '@modyfi/vite-plugin-yaml'
import vitePluginReact from '@vitejs/plugin-react'
import * as vite from 'vite'
import * as common from 'enso-common'
import * as appConfig from 'enso-common/src/appConfig'
// =====================
// === Configuration ===
// =====================
const SERVER_PORT = 8080
await appConfig.readEnvironmentFromFile()
/* eslint-disable @typescript-eslint/naming-convention */
export default vite.defineConfig({
server: { port: SERVER_PORT, headers: Object.fromEntries(common.COOP_COEP_CORP_HEADERS) },
plugins: [
vitePluginReact({
include: '**/*.tsx',
babel: { plugins: ['@babel/plugin-syntax-import-assertions'] },
}),
vitePluginYaml(),
],
resolve: {
alias: {
'#': url.fileURLToPath(new URL('./src', import.meta.url)),
},
},
build: {
rollupOptions: {
input: {
main: url.fileURLToPath(new URL('./index.html', import.meta.url)),
'404': url.fileURLToPath(new URL('./404.html', import.meta.url)),
},
},
},
define: {
IS_VITE: JSON.stringify(true),
// The sole hardcoded usage of `global` in aws-amplify.
'global.TYPED_ARRAY_SUPPORT': JSON.stringify(true),
...appConfig.getDefines(SERVER_PORT),
},
})