//vite-repro-silentbykazupon

vite-repro-silent

0
0
0
TypeScript

Reproduction: resolveConfig({ logLevel: 'silent' }) does not suppress Rolldown warnings

Problem

When calling resolveConfig({ logLevel: 'silent' }), Rolldown still prints UNRESOLVED_IMPORT warnings to stderr during config file bundling. The logLevel option is not propagated from loadConfigFromFilebundleConfigFilerolldown().

Steps to reproduce

npm install
npx tsx repro.ts

Expected

No output to stderr — logLevel: 'silent' should suppress all warnings including Rolldown’s bundler warnings.

Actual

Rolldown prints UNRESOLVED_IMPORT warning for @vitejs/plugin-react (which is intentionally not installed to trigger the warning):

vite.config.ts (2:19) [UNRESOLVED_IMPORT] Warning: Could not resolve '@vitejs/plugin-react' in vite.config.ts
   ╭─[ vite.config.ts:2:20 ]
   │
 2 │ import react from '@vitejs/plugin-react';
   │                    ───────────┬──────────
   │                               ╰──────────── Module not found, treating it as an external dependency
───╯

Root cause

In packages/vite/src/node/config.ts:

resolveConfig({ logLevel: 'silent' })
  → loadConfigFromFile(configEnv, configFile, root, logLevel, ...)  // logLevel received
    → bundleAndLoadConfigFile(resolvedPath)                          // logLevel NOT passed
      → bundleConfigFile(fileName, isESM)                            // logLevel NOT passed
        → rolldown({ ... })                                          // no logLevel option

Rolldown’s rolldown() function supports logLevel as an input option, so the fix is to pass it through the chain.

[beta]v0.14.0