Home / Function/ convertEsbuildConfigToOxcConfig() — vite Function Reference

convertEsbuildConfigToOxcConfig() — vite Function Reference

Architecture documentation for the convertEsbuildConfigToOxcConfig() function in oxc.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  5422f6bd_118c_9400_d948_98a879fa8635["convertEsbuildConfigToOxcConfig()"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b["oxc.ts"]
  5422f6bd_118c_9400_d948_98a879fa8635 -->|defined in| 16dc8750_0d4e_ed3e_3844_b80096ed2e0b
  58c4a210_68fe_1b4d_ed49_d59203f97ef1["resolveConfig()"]
  58c4a210_68fe_1b4d_ed49_d59203f97ef1 -->|calls| 5422f6bd_118c_9400_d948_98a879fa8635
  64dfb5e8_b4f5_a2a7_7365_2a4bee1469be["warnDeprecatedShouldBeConvertedToPluginOptions()"]
  5422f6bd_118c_9400_d948_98a879fa8635 -->|calls| 64dfb5e8_b4f5_a2a7_7365_2a4bee1469be
  style 5422f6bd_118c_9400_d948_98a879fa8635 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/oxc.ts lines 475–536

export function convertEsbuildConfigToOxcConfig(
  esbuildConfig: ESBuildOptions,
  logger: Logger,
): OxcOptions {
  const { jsxInject, include, exclude, ...esbuildTransformOptions } =
    esbuildConfig

  const oxcOptions: OxcOptions = {
    jsxInject,
    include,
    exclude,
  }

  if (esbuildTransformOptions.jsx === 'preserve') {
    oxcOptions.jsx = 'preserve'
  } else {
    const jsxOptions: OxcJsxOptions = {}

    switch (esbuildTransformOptions.jsx) {
      case 'automatic':
        jsxOptions.runtime = 'automatic'
        if (esbuildTransformOptions.jsxImportSource) {
          jsxOptions.importSource = esbuildTransformOptions.jsxImportSource
        }
        break
      case 'transform':
        jsxOptions.runtime = 'classic'
        if (esbuildTransformOptions.jsxFactory) {
          jsxOptions.pragma = esbuildTransformOptions.jsxFactory
        }
        if (esbuildTransformOptions.jsxFragment) {
          jsxOptions.pragmaFrag = esbuildTransformOptions.jsxFragment
        }
        break
      default:
        break
    }

    if (esbuildTransformOptions.jsxDev !== undefined) {
      jsxOptions.development = esbuildTransformOptions.jsxDev
    }
    if (esbuildTransformOptions.jsxSideEffects !== undefined) {
      jsxOptions.pure = esbuildTransformOptions.jsxSideEffects
    }

    oxcOptions.jsx = jsxOptions
  }

  if (esbuildTransformOptions.define) {
    oxcOptions.define = esbuildTransformOptions.define
  }

  // these backward compat are supported by esbuildBannerFooterCompatPlugin
  if (esbuildTransformOptions.banner) {
    warnDeprecatedShouldBeConvertedToPluginOptions(logger, 'banner')
  }
  if (esbuildTransformOptions.footer) {
    warnDeprecatedShouldBeConvertedToPluginOptions(logger, 'footer')
  }

  return oxcOptions
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does convertEsbuildConfigToOxcConfig() do?
convertEsbuildConfigToOxcConfig() is a function in the vite codebase, defined in packages/vite/src/node/plugins/oxc.ts.
Where is convertEsbuildConfigToOxcConfig() defined?
convertEsbuildConfigToOxcConfig() is defined in packages/vite/src/node/plugins/oxc.ts at line 475.
What does convertEsbuildConfigToOxcConfig() call?
convertEsbuildConfigToOxcConfig() calls 1 function(s): warnDeprecatedShouldBeConvertedToPluginOptions.
What calls convertEsbuildConfigToOxcConfig()?
convertEsbuildConfigToOxcConfig() is called by 1 function(s): resolveConfig.

Analyze Your Own Codebase

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

Try Supermodel Free