enso/app/ide-desktop/lib/dashboard/vite.config.ts
somebody1234 129022ae12
Support for creating and editing Data Links (#8882)
- Close https://github.com/enso-org/cloud-v2/issues/734
- Add modal to create a new Data Link
- Add the same input to the asset right panel
- Add entries on context menu and Drive Bar
- The shortcut is <kbd>Cmd</kbd>+<kbd>Shift</kbd>+<kbd>Alt</kbd>+<kbd>N</kbd>
- Add (and use) corresponding backend endpoints

# Important Notes
- All UI is currently generated based off of a single-source-of-truth JSON Schema file.
- JSON Schema was chosen for a few reasons:
- trivial to parse (it's plain JSON)
- sufficiently powerful (supports unions (used in the initial schema), objects, and singleton/literal types)
- but still quite simple (this makes it easier to implement various utilities for, because there are fewer cases to cover)
- Note that it is definitely possible to change this. The original suggestion was a TypeScript file, which can definitely be done even using just the `typescript` package itself - I just prefer to avoid adding another step in the build process, especially one that depends on the `typescript` package at runtime.
- Note also that we *do* actually bundle transpilers as part of the visualization loading code in GUI2 - so for now at least, the size of the dependency isn't a primary concern, but rather just the mental overhead of having another dependency for this one specific task.
2024-02-12 10:05:30 +00:00

55 lines
1.4 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'
// =================
// === Constants ===
// =================
const SERVER_PORT = 8080
// =====================
// === Configuration ===
// =====================
/* 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),
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),
},
})