Home / File/ index.js — vite Source File

index.js — vite Source File

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

File javascript ViteCore BuildPipeline 2 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  07ce74ca_94d0_c873_e934_8065769c368c["index.js"]
  33c8a7ad_f7ce_39df_d5ed_3f80bde8cf37["mxd.js"]
  07ce74ca_94d0_c873_e934_8065769c368c --> 33c8a7ad_f7ce_39df_d5ed_3f80bde8cf37
  56ae1d01_b01e_38d6_8c08_b4cebe288add["mxd.json"]
  07ce74ca_94d0_c873_e934_8065769c368c --> 56ae1d01_b01e_38d6_8c08_b4cebe288add
  style 07ce74ca_94d0_c873_e934_8065769c368c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import mxdStatic from '../files/mxd'
import mxdStaticJSON from '../files/mxd.json'

async function setView(view) {
  const { msg } = await import(`../views/${view}.js`)
  text('.view', msg)
}

;['foo', 'bar'].forEach((id) => {
  document.querySelector(`.${id}`).addEventListener('click', () => setView(id))
})

// literal dynamic
document.querySelector('.baz').addEventListener('click', async () => {
  const { msg } = await import('../views/baz.js')
  text('.view', msg)
})

// full dynamic
const arr = ['qux.js']
const view = `/views/${arr[0]}`
document.querySelector('.qux').addEventListener('click', async () => {
  const { msg } = await import(/*@vite-ignore*/ view)
  text('.view', msg)
})

// mixed static and dynamic
document.querySelector('.mxd').addEventListener('click', async () => {
  const view = 'mxd'
  const { default: mxdDynamic } = await import(`../files/${view}.js`)
  text('.view', mxdStatic === mxdDynamic)
})

document.querySelector('.mxd2').addEventListener('click', async () => {
  const test = { jss: '../files/mxd.js' }
  const ttest = test
  const view = 'mxd'
  const { default: mxdDynamic } = await import(/*@vite-ignore*/ test.jss)
  text('.view', mxdStatic === mxdDynamic)
})

document.querySelector('.mxdjson').addEventListener('click', async () => {
  const view = 'mxd'
  const { default: mxdDynamicJSON } = await import(`../files/${view}.json`)
  text('.view', mxdStaticJSON === mxdDynamicJSON)
})

// data URLs (`blob:`)
const code1 = 'export const msg = "blob"'
const blob = new Blob([code1], { type: 'text/javascript;charset=UTF-8' })
const blobURL = URL.createObjectURL(blob)
document.querySelector('.issue-2658-1').addEventListener('click', async () => {
  const { msg } = await import(/*@vite-ignore*/ blobURL)
  text('.view', msg)
})

// data URLs (`data:`)
const code2 = 'export const msg = "data";'
const dataURL = `data:text/javascript;charset=utf-8,${encodeURIComponent(
  code2,
// ... (145 more lines)

Domain

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does index.js do?
index.js is a source file in the vite codebase, written in javascript. It belongs to the ViteCore domain, BuildPipeline subdomain.
What functions are defined in index.js?
index.js defines 2 function(s): setView, text.
What does index.js depend on?
index.js imports 2 module(s): mxd.js, mxd.json.
Where is index.js in the architecture?
index.js is located at playground/dynamic-import/nested/index.js (domain: ViteCore, subdomain: BuildPipeline, directory: playground/dynamic-import/nested).

Analyze Your Own Codebase

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

Try Supermodel Free