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, 4 dependents.

File javascript ViteCore 4 imports 4 dependents

Entity Profile

Dependency Diagram

graph LR
  20d4b7dc_5732_43e7_ff19_a382aba5dfc5["vite.config.js"]
  51e96894_3556_ed5c_1ede_97d449867adf["node:path"]
  20d4b7dc_5732_43e7_ff19_a382aba5dfc5 --> 51e96894_3556_ed5c_1ede_97d449867adf
  6feed3e8_55b8_cce7_b5ef_e40b872585f7["node:url"]
  20d4b7dc_5732_43e7_ff19_a382aba5dfc5 --> 6feed3e8_55b8_cce7_b5ef_e40b872585f7
  0df9a6ad_9884_8e58_5c89_258532804430["stylus"]
  20d4b7dc_5732_43e7_ff19_a382aba5dfc5 --> 0df9a6ad_9884_8e58_5c89_258532804430
  54c37fea_4fe7_2693_71cb_1276b77f55f9["vite"]
  20d4b7dc_5732_43e7_ff19_a382aba5dfc5 --> 54c37fea_4fe7_2693_71cb_1276b77f55f9
  5c81aa76_dd42_9d68_2485_64577867dfb7["vite.config-lightningcss.js"]
  5c81aa76_dd42_9d68_2485_64577867dfb7 --> 20d4b7dc_5732_43e7_ff19_a382aba5dfc5
  82ddfb9d_13a7_c492_13af_503196df09ea["vite.config-no-css-minify.js"]
  82ddfb9d_13a7_c492_13af_503196df09ea --> 20d4b7dc_5732_43e7_ff19_a382aba5dfc5
  1c233b5c_0266_5890_42e6_7c23ed08b8ce["vite.config-relative-base.js"]
  1c233b5c_0266_5890_42e6_7c23ed08b8ce --> 20d4b7dc_5732_43e7_ff19_a382aba5dfc5
  dd0c1ec0_7123_8f82_a518_5be2e44f905b["vite.config-same-file-name.js"]
  dd0c1ec0_7123_8f82_a518_5be2e44f905b --> 20d4b7dc_5732_43e7_ff19_a382aba5dfc5
  style 20d4b7dc_5732_43e7_ff19_a382aba5dfc5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import path from 'node:path'
import { pathToFileURL } from 'node:url'
import stylus from 'stylus'
import { defineConfig } from 'vite'

// trigger scss bug: https://github.com/sass/dart-sass/issues/710
// make sure Vite handles safely
// @ts-expect-error refer to https://github.com/vitejs/vite/pull/11079
globalThis.window = {}
// @ts-expect-error refer to https://github.com/vitejs/vite/pull/11079
globalThis.location = new URL('http://localhost/')

const dirname = import.meta.dirname

export default defineConfig({
  plugins: [
    {
      // Emulate a UI framework component where a framework module would import
      // scoped CSS files that should treeshake if the default export is not used.
      name: 'treeshake-scoped-css',
      enforce: 'pre',
      async resolveId(id, importer) {
        if (!importer || !id.endsWith('-scoped.css')) return

        const resolved = await this.resolve(id, importer)
        if (!resolved) return

        return {
          ...resolved,
          meta: {
            vite: {
              cssScopeTo: [
                importer,
                resolved.id.includes('barrel') ? undefined : 'default',
              ],
            },
          },
        }
      },
    },
  ],
  build: {
    cssTarget: 'chrome61',
    rollupOptions: {
      input: {
        index: path.resolve(dirname, './index.html'),
        treeshakeScoped: path.resolve(dirname, './treeshake-scoped/index.html'),
        empty: path.resolve(dirname, './empty.css'),
      },
      output: {
        manualChunks(id) {
          if (id.includes('manual-chunk.css')) {
            return 'dir/dir2/manual-chunk'
          }
        },
      },
    },
  },
  esbuild: {
    logOverride: {
// ... (89 more lines)

Domain

Dependencies

  • node:path
  • node:url
  • stylus
  • 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.
What does vite.config.js depend on?
vite.config.js imports 4 module(s): node:path, node:url, stylus, vite.
What files import vite.config.js?
vite.config.js is imported by 4 file(s): vite.config-lightningcss.js, vite.config-no-css-minify.js, vite.config-relative-base.js, vite.config-same-file-name.js.
Where is vite.config.js in the architecture?
vite.config.js is located at playground/css/vite.config.js (domain: ViteCore, directory: playground/css).

Analyze Your Own Codebase

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

Try Supermodel Free