shouldInline() — vite Function Reference
Architecture documentation for the shouldInline() function in asset.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD f792863c_a1f0_39ad_4cf9_836f9b945919["shouldInline()"] e71b94ef_3010_e358_13d8_f3b3acb0a268["asset.ts"] f792863c_a1f0_39ad_4cf9_836f9b945919 -->|defined in| e71b94ef_3010_e358_13d8_f3b3acb0a268 eec82f76_7029_ae97_4449_1665a4f204d8["fileToDevUrl()"] eec82f76_7029_ae97_4449_1665a4f204d8 -->|calls| f792863c_a1f0_39ad_4cf9_836f9b945919 86195de2_9c12_1f7e_7a3e_0754a5695ebe["fileToBuiltUrl()"] 86195de2_9c12_1f7e_7a3e_0754a5695ebe -->|calls| f792863c_a1f0_39ad_4cf9_836f9b945919 a1a54c72_e5af_63a4_544f_313ad8815637["isGitLfsPlaceholder()"] f792863c_a1f0_39ad_4cf9_836f9b945919 -->|calls| a1a54c72_e5af_63a4_544f_313ad8815637 style f792863c_a1f0_39ad_4cf9_836f9b945919 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/plugins/asset.ts lines 535–565
function shouldInline(
environment: Environment,
file: string,
id: string,
content: Buffer,
/** Should be passed only in build */
buildPluginContext: PluginContext | undefined,
forceInline: boolean | undefined,
): boolean {
if (noInlineRE.test(id)) return false
if (inlineRE.test(id)) return true
// Do build only checks if passed the plugin context during build
if (buildPluginContext) {
if (environment.config.build.lib) return true
if (buildPluginContext.getModuleInfo(id)?.isEntry) return false
}
if (forceInline !== undefined) return forceInline
if (file.endsWith('.html')) return false
// Don't inline SVG with fragments, as they are meant to be reused
if (file.endsWith('.svg') && id.includes('#')) return false
let limit: number
const { assetsInlineLimit } = environment.config.build
if (typeof assetsInlineLimit === 'function') {
const userShouldInline = assetsInlineLimit(file, content)
if (userShouldInline != null) return userShouldInline
limit = DEFAULT_ASSETS_INLINE_LIMIT
} else {
limit = Number(assetsInlineLimit)
}
return content.length < limit && !isGitLfsPlaceholder(content)
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does shouldInline() do?
shouldInline() is a function in the vite codebase, defined in packages/vite/src/node/plugins/asset.ts.
Where is shouldInline() defined?
shouldInline() is defined in packages/vite/src/node/plugins/asset.ts at line 535.
What does shouldInline() call?
shouldInline() calls 1 function(s): isGitLfsPlaceholder.
What calls shouldInline()?
shouldInline() is called by 2 function(s): fileToBuiltUrl, fileToDevUrl.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free