Home / File/ vite.config.js — vite Source File

vite.config.js — vite Source File

Architecture documentation for vite.config.js, a javascript file in the vite codebase. 4 imports, 0 dependents.

File javascript ViteCore ConfigEngine 4 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  04aec4e5_ff04_ec8c_1327_5f33ef4c2483["vite.config.js"]
  e6032fbc_44cf_58d6_868d_dd15106c18c5["node:fs"]
  04aec4e5_ff04_ec8c_1327_5f33ef4c2483 --> e6032fbc_44cf_58d6_868d_dd15106c18c5
  51e96894_3556_ed5c_1ede_97d449867adf["node:path"]
  04aec4e5_ff04_ec8c_1327_5f33ef4c2483 --> 51e96894_3556_ed5c_1ede_97d449867adf
  cf687cc4_e681_5bde_69ac_ab4303d465f7["plugin-legacy"]
  04aec4e5_ff04_ec8c_1327_5f33ef4c2483 --> cf687cc4_e681_5bde_69ac_ab4303d465f7
  54c37fea_4fe7_2693_71cb_1276b77f55f9["vite"]
  04aec4e5_ff04_ec8c_1327_5f33ef4c2483 --> 54c37fea_4fe7_2693_71cb_1276b77f55f9
  style 04aec4e5_ff04_ec8c_1327_5f33ef4c2483 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import fs from 'node:fs'
import path from 'node:path'
import legacy from '@vitejs/plugin-legacy'
import { defineConfig } from 'vite'

export default defineConfig({
  base: './',
  plugins: [
    legacy({
      targets: 'IE 11',
      modernPolyfills: true,
    }),
  ],

  build: {
    cssCodeSplit: false,
    manifest: true,
    sourcemap: true,
    assetsInlineLimit: 100, // keep SVG as assets URL
    rollupOptions: {
      input: {
        index: path.resolve(import.meta.dirname, 'index.html'),
        nested: path.resolve(import.meta.dirname, 'nested/index.html'),
      },
      output: {
        chunkFileNames(chunkInfo) {
          if (chunkInfo.name === 'immutable-chunk') {
            return `assets/${chunkInfo.name}.js`
          } else if (/custom\d/.test(chunkInfo.name)) {
            return `assets/chunk-X${
              ['.', '-', ''][/custom(\d)/.exec(chunkInfo.name)[1]]
            }[hash].js`
          }
          return `assets/chunk-[name].[hash].js`
        },
      },
    },
  },

  // for tests, remove `<script type="module">` tags and remove `nomodule`
  // attrs so that we run the legacy bundle instead.
  __test__() {
    const indexPath = path.resolve(import.meta.dirname, './dist/index.html')
    let index = fs.readFileSync(indexPath, 'utf-8')
    index = index
      .replace(/<script type="module".*?<\/script>/g, '')
      .replace(/<script nomodule/g, '<script')
    fs.writeFileSync(indexPath, index)
  },
})

Domain

Subdomains

Functions

Dependencies

  • node:fs
  • node:path
  • plugin-legacy
  • vite

Frequently Asked Questions

What does vite.config.js do?
vite.config.js is a source file in the vite codebase, written in javascript. It belongs to the ViteCore domain, ConfigEngine subdomain.
What functions are defined in vite.config.js?
vite.config.js defines 1 function(s): default.__test__.
What does vite.config.js depend on?
vite.config.js imports 4 module(s): node:fs, node:path, plugin-legacy, vite.
Where is vite.config.js in the architecture?
vite.config.js is located at playground/legacy/vite.config.js (domain: ViteCore, subdomain: ConfigEngine, directory: playground/legacy).

Analyze Your Own Codebase

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

Try Supermodel Free