Skip to content

Commit

Permalink
fix: finally supress Vite out dir warning
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Jul 10, 2024
1 parent f7d66b4 commit 3ff6ccb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import vueJsxPlugin from '@vitejs/plugin-vue2-jsx'
import fullReloadPlugin from 'vite-plugin-full-reload'
import externalGlobals from 'rollup-plugin-external-globals'
import type { OutputChunk, RollupOutput } from 'rollup'
import type { InlineConfig } from 'vite'
import type { InlineConfig, LogLevel } from 'vite'
import { name, version } from '../../package.json'
import { PrettyError, handleError } from './errors'
import { printFileInfo, toArray } from './utils'
Expand All @@ -24,12 +24,13 @@ import type { BaseOptions, BuildOptions, PostCSSConfigResult, ServeOptions, User
let resolvedKirbyupConfig: UserConfig
let resolvedPostCssConfig: PostCSSConfigResult

const logger = createLogger()
const logLevel: LogLevel = 'warn'
const logger = createLogger(logLevel)
const loggerWarn = logger.warn

// Overwrite log function to ignore output directory warning
logger.warn = (msg, options) => {
// Ignore output directory warning for Kirby plugin builds
if (msg.startsWith(`\n(!) build.outDir must not be`))
if (msg.includes('(!) build.outDir'))
return

loggerWarn(msg, options)
Expand Down Expand Up @@ -64,7 +65,7 @@ function getViteConfig(
css: { postcss: resolvedPostCssConfig },
envPrefix: ['VITE_', 'KIRBYUP_'],
customLogger: logger,
logLevel: 'warn',
logLevel,
}

if (command === 'serve') {
Expand Down

0 comments on commit 3ff6ccb

Please sign in to comment.