fix(nuxi, vite): suppress sourcemap + native fetch warnings (#20198)

This commit is contained in:
Daniel Roe 2023-04-11 13:46:49 +01:00 committed by GitHub
parent 0443a283d9
commit 89ab2e522d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -54,6 +54,11 @@ const wrapReporter = (reporter: ConsolaReporter) => ({
if (msg.startsWith('[Vue Router warn]: No match found for location with path')) {
return
}
// Suppress warning about native Node.js fetch
if (msg.includes('ExperimentalWarning: The Fetch API is an experimental feature')) {
return
}
// TODO: resolve upstream in Vite
// Hide sourcemap warnings related to node_modules
if (msg.startsWith('Sourcemap') && msg.includes('node_modules')) {
return

View File

@ -27,6 +27,12 @@ export function createViteLogger (config: vite.InlineConfig): vite.Logger {
const clearScreen = canClearScreen ? clear : () => {}
function output (type: vite.LogType, msg: string, options: vite.LogErrorOptions = {}) {
if (typeof msg === 'string' && !process.env.DEBUG) {
// TODO: resolve upstream in Vite
// Hide sourcemap warnings related to node_modules
if (msg.startsWith('Sourcemap') && msg.includes('node_modules')) { return }
}
const sameAsLast = lastType === type && lastMsg === msg
if (sameAsLast) {
duplicateCount += 1