Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Apache Dolphinscheduler Vite Build Configuration

From Leeroopedia


Knowledge Sources
Domains Frontend, Build_Configuration
Last Updated 2026-02-10 00:00 GMT

Overview

Concrete Vite build configuration that defines plugin pipeline, path resolution, asset compression, and development proxy for the DolphinScheduler frontend module.

Description

The vite.config.ts file configures the Vite 3 build tool for the dolphinscheduler-ui module. It registers three plugins: @vitejs/plugin-vue for Vue SFC compilation, @vitejs/plugin-vue-jsx for JSX/TSX support, and vite-plugin-compression for gzip compression of production assets exceeding 10KB. The production base path is set to /dolphinscheduler/ui/ to match the backend's static asset serving path. A path alias maps @ to the src directory. The development server proxies all /dolphinscheduler API requests to the backend URL specified in .env.development via VITE_APP_DEV_WEB_URL.

Usage

This file is consumed automatically by Vite when running pnpm run dev (development) or pnpm run build:prod (production). Modify it to change build plugins, add path aliases, adjust compression settings, or configure additional dev server proxies.

Code Reference

Source Location

Signature

import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import viteCompression from 'vite-plugin-compression'
import path from 'path'

export default defineConfig({
  base: process.env.NODE_ENV === 'production' ? '/dolphinscheduler/ui/' : '/',
  plugins: [
    vue(),
    vueJsx(),
    viteCompression({
      verbose: true,
      disable: false,
      threshold: 10240,
      algorithm: 'gzip',
      ext: '.gz',
      deleteOriginFile: false
    })
  ],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    }
  },
  server: {
    proxy: {
      '/dolphinscheduler': {
        target: loadEnv('development', './').VITE_APP_DEV_WEB_URL,
        changeOrigin: true
      }
    }
  }
})

Import

# Not imported directly; consumed by Vite CLI
pnpm run dev        # Uses config for dev server
pnpm run build:prod # Uses config for production build

I/O Contract

Inputs

Name Type Required Description
.env.development Environment file No Contains VITE_APP_DEV_WEB_URL for API proxy target
NODE_ENV Environment variable No Determines base path (production vs development)
src/ Source directory Yes Vue SFC, TypeScript, and asset files to compile

Outputs

Name Type Description
dist/ Directory Compiled and compressed production bundle under /dolphinscheduler/ui/ base path
*.gz Files Gzip-compressed versions of assets over 10KB
Dev server HTTP HMR dev server with API proxy to backend

Usage Examples

Development With API Proxy

# Create .env.development with backend URL
echo "VITE_APP_DEV_WEB_URL=http://localhost:12345" > dolphinscheduler-ui/.env.development

# Start dev server; API calls to /dolphinscheduler/* are proxied to backend
cd dolphinscheduler-ui
pnpm run dev

Production Build With Compression

cd dolphinscheduler-ui

# Build for production (base path: /dolphinscheduler/ui/)
NODE_ENV=production pnpm run build:prod

# Output in dist/ includes .gz compressed files for assets > 10KB
ls dist/assets/*.gz

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment