Skip to content

Commit

Permalink
refactor: clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework committed Jan 30, 2023
1 parent ee50bae commit 90780c3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/vite-plugin-checker/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function checker(userConfig: UserPluginConfig): Plugin {
let initialized = false
let initializeCounter = 0
let checkers: ServeAndBuildChecker[] = []
let skipRuntime = false
let isProduction = false
let devBase = '/'
let viteMode: ConfigEnv['command'] | undefined
let buildWatch = false
Expand Down Expand Up @@ -99,7 +99,7 @@ export function checker(userConfig: UserPluginConfig): Plugin {
configResolved(config) {
logger = config.logger
devBase = config.base
skipRuntime ||= config.isProduction || config.command === 'build'
isProduction ||= config.isProduction || config.command === 'build'
buildWatch = !!config.build.watch
},
buildEnd() {
Expand Down Expand Up @@ -132,7 +132,7 @@ export function checker(userConfig: UserPluginConfig): Plugin {
},
transformIndexHtml() {
if (initialized) return
if (skipRuntime) return
if (isProduction) return

return [
{
Expand All @@ -146,7 +146,7 @@ export function checker(userConfig: UserPluginConfig): Plugin {
if (initialized) return
// only run in build mode
// run a bin command in a separated process
if (!skipRuntime || !enableBuild) return
if (!isProduction || !enableBuild) return

const localEnv = npmRunPath.env({
env: process.env,
Expand Down

0 comments on commit 90780c3

Please sign in to comment.