onRollupLog() — vite Function Reference
Architecture documentation for the onRollupLog() function in build.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD 5f780e97_091a_dfa9_1506_327f54d41dca["onRollupLog()"] 45981d85_cbdd_e969_8c88_c17072ea0eda["build.ts"] 5f780e97_091a_dfa9_1506_327f54d41dca -->|defined in| 45981d85_cbdd_e969_8c88_c17072ea0eda a016fb65_b1f4_be50_c5c3_d0c8f7b2ab52["resolveRolldownOptions()"] a016fb65_b1f4_be50_c5c3_d0c8f7b2ab52 -->|calls| 5f780e97_091a_dfa9_1506_327f54d41dca 75aa4483_7f33_5bdd_19ac_866cac2679e4["bundleWorkerEntry()"] 75aa4483_7f33_5bdd_19ac_866cac2679e4 -->|calls| 5f780e97_091a_dfa9_1506_327f54d41dca 23a2e685_f919_9578_27ba_bde71c122058["createDebugger()"] 5f780e97_091a_dfa9_1506_327f54d41dca -->|calls| 23a2e685_f919_9578_27ba_bde71c122058 0ae44fcb_cb76_b322_98e1_3bb6cce3ebde["clearLine()"] 5f780e97_091a_dfa9_1506_327f54d41dca -->|calls| 0ae44fcb_cb76_b322_98e1_3bb6cce3ebde 16174712_0c01_7a74_cb0a_25c035192a06["normalizeUserOnWarn()"] 5f780e97_091a_dfa9_1506_327f54d41dca -->|calls| 16174712_0c01_7a74_cb0a_25c035192a06 7e22b0a1_210d_c2ca_9a20_17eec3acb06f["info()"] 5f780e97_091a_dfa9_1506_327f54d41dca -->|calls| 7e22b0a1_210d_c2ca_9a20_17eec3acb06f 3cf1d94a_16a2_96d6_7d1d_9757e22a2557["warn()"] 5f780e97_091a_dfa9_1506_327f54d41dca -->|calls| 3cf1d94a_16a2_96d6_7d1d_9757e22a2557 8127cae8_510b_1333_1a76_2d21b503c3a6["error()"] 5f780e97_091a_dfa9_1506_327f54d41dca -->|calls| 8127cae8_510b_1333_1a76_2d21b503c3a6 style 5f780e97_091a_dfa9_1506_327f54d41dca fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/build.ts lines 1061–1143
export function onRollupLog(
level: LogLevel,
log: RollupLog,
environment: Environment,
): void {
const debugLogger = createDebugger('vite:build')
const viteLog: LogOrStringHandler = (logLeveling, rawLogging) => {
const logging =
typeof rawLogging === 'object' ? rawLogging : { message: rawLogging }
if (logging.code === 'UNRESOLVED_IMPORT') {
const id = logging.id
const exporter = logging.exporter
// throw unless it's commonjs external...
if (!id || !id.endsWith('?commonjs-external')) {
throw new Error(
`[vite]: Rolldown failed to resolve import "${exporter}" from "${id}".\n` +
`This is most likely unintended because it can break your application at runtime.\n` +
`If you do want to externalize this module explicitly add it to\n` +
`\`build.rollupOptions.external\``,
)
}
}
if (logLeveling === 'warn') {
if (
logging.plugin === 'rollup-plugin-dynamic-import-variables' &&
dynamicImportWarningIgnoreList.some((msg) =>
logging.message.includes(msg),
)
) {
return
}
if (warningIgnoreList.includes(logging.code!)) {
return
}
}
// append plugin name to align with Rollup's behavior
let message = logging.message
if (logging.plugin) {
message = `[plugin ${logging.plugin}] ${message}`
}
switch (logLeveling) {
case 'info':
environment.logger.info(message)
return
case 'warn':
environment.logger.warn(colors.yellow(message))
return
case 'error':
environment.logger.error(colors.red(message))
return
case 'debug':
debugLogger?.(message)
return
default:
logLeveling satisfies never
// fallback to info if a unknown log level is passed
environment.logger.info(message)
return
}
}
clearLine()
const userOnLog = environment.config.build.rollupOptions?.onLog
const userOnWarn = environment.config.build.rollupOptions?.onwarn
if (userOnLog) {
if (userOnWarn) {
const normalizedUserOnWarn = normalizeUserOnWarn(userOnWarn, viteLog)
userOnLog(level, log, normalizedUserOnWarn)
} else {
userOnLog(level, log, viteLog)
}
} else if (userOnWarn) {
const normalizedUserOnWarn = normalizeUserOnWarn(userOnWarn, viteLog)
normalizedUserOnWarn(level, log)
} else {
viteLog(level, log)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does onRollupLog() do?
onRollupLog() is a function in the vite codebase, defined in packages/vite/src/node/build.ts.
Where is onRollupLog() defined?
onRollupLog() is defined in packages/vite/src/node/build.ts at line 1061.
What does onRollupLog() call?
onRollupLog() calls 6 function(s): clearLine, createDebugger, error, info, normalizeUserOnWarn, warn.
What calls onRollupLog()?
onRollupLog() is called by 2 function(s): bundleWorkerEntry, resolveRolldownOptions.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free