Home / Function/ BackendIntegrationExample() — vite Function Reference

BackendIntegrationExample() — vite Function Reference

Architecture documentation for the BackendIntegrationExample() function in vite.config.js from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  74fba919_d3d7_1d4f_7cc3_10c1d816981a["BackendIntegrationExample()"]
  8d04ac38_01d9_e2ee_5ded_ff544e9f5063["vite.config.js"]
  74fba919_d3d7_1d4f_7cc3_10c1d816981a -->|defined in| 8d04ac38_01d9_e2ee_5ded_ff544e9f5063
  style 74fba919_d3d7_1d4f_7cc3_10c1d816981a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

playground/backend-integration/vite.config.js lines 9–57

function BackendIntegrationExample() {
  return {
    name: 'backend-integration',
    config() {
      const projectRoot = import.meta.dirname
      const sourceCodeDir = path.join(projectRoot, 'frontend')
      const root = path.join(sourceCodeDir, 'entrypoints')
      const outDir = path.relative(root, path.join(projectRoot, 'dist/dev'))

      const entrypoints = globSync(`${normalizePath(root)}/**/*`, {
        absolute: true,
        expandDirectories: false,
        onlyFiles: true,
      }).map((filename) => [path.relative(root, filename), filename])

      entrypoints.push(['tailwindcss-colors', 'tailwindcss/colors.js'])
      entrypoints.push(['bar.css', path.resolve(projectRoot, './dir/foo.css')])
      entrypoints.push([
        'bar.custom',
        path.resolve(projectRoot, './dir/custom.css'),
      ])

      return {
        server: {
          // same port in playground/test-utils.ts
          port: 5009,
          strictPort: true,
          origin: 'http://localhost:5009',
        },
        preview: {
          port: 5009,
        },
        build: {
          manifest: true,
          outDir,
          rollupOptions: {
            input: Object.fromEntries(entrypoints),
          },
        },
        root,
        resolve: {
          alias: {
            '~': sourceCodeDir,
          },
        },
      }
    },
  }
}

Domain

Subdomains

Frequently Asked Questions

What does BackendIntegrationExample() do?
BackendIntegrationExample() is a function in the vite codebase, defined in playground/backend-integration/vite.config.js.
Where is BackendIntegrationExample() defined?
BackendIntegrationExample() is defined in playground/backend-integration/vite.config.js at line 9.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free