提交 3b0f7ae1 编写于 作者: fxy060608's avatar fxy060608

fix: remove duplicate log

上级 5f2fb9fe
......@@ -2,6 +2,7 @@ import type { WatchOptions } from 'chokidar'
import type { Plugin, ResolvedConfig } from 'vite'
import { FileWatcher, FileWatcherOptions } from '../../watcher'
import { M } from '../../messages'
import { output } from '../../logs'
export type UniViteCopyPluginTarget = Omit<FileWatcherOptions, 'verbose'> & {
watchOptions?: WatchOptions
......@@ -15,7 +16,7 @@ export function uniViteCopyPlugin({
verbose,
}: UniViteCopyPluginOptions): Plugin {
let resolvedConfig: ResolvedConfig
let inited = false
let initialized = false
return {
name: 'uni:copy',
apply: 'build',
......@@ -23,13 +24,13 @@ export function uniViteCopyPlugin({
resolvedConfig = config
},
writeBundle() {
if (inited) {
if (initialized) {
return
}
if (resolvedConfig.build.ssr) {
return
}
inited = true
initialized = true
return new Promise((resolve) => {
Promise.all(
targets.map(({ watchOptions, ...target }) => {
......@@ -53,7 +54,8 @@ export function uniViteCopyPlugin({
}
},
() => {
console.log(M['dev.watching.end'])
// TODO 目前初始化编译时,也会不停地触发此函数。
output('log', M['dev.watching.end'])
}
)
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册