Skip to content

Commit

Permalink
fix(uts): iOS 平台编译 css 时正常输出编译告警信息 #3855
Browse files Browse the repository at this point in the history
  • Loading branch information
Otto-J committed Jul 23, 2024
1 parent 0503fe4 commit b521ffe
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions packages/uni-app-uts/src/plugins/ios/css.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { Plugin, ResolvedConfig } from 'vite'
// import colors from 'picocolors'
import colors from 'picocolors'

import {
commonjsProxyRE,
cssLangRE,
// formatAtFilename,
// generateCodeFrame,
formatAtFilename,
generateCodeFrame,
parseAssets,
preUVueCss,
} from '@dcloudio/uni-cli-shared'
Expand Down Expand Up @@ -35,20 +35,19 @@ export function uniAppCssPlugin(resolvedConfig: ResolvedConfig): Plugin {
})
messages.forEach((message) => {
if (message.type === 'warning') {
// 暂不输出警告日志
// 拆分成多行,第一行输出信息(有颜色),后续输出错误代码+文件行号
// resolvedConfig.logger.warn(
// colors.yellow(`[plugin:uni:app-uvue-css] ${message.text}`)
// )
// let msg = ''
// if (message.line && message.column) {
// msg += `\n${generateCodeFrame(source, {
// line: message.line,
// column: message.column,
// }).replace(/\t/g, ' ')}\n`
// }
// msg += `${formatAtFilename(filename)}`
// resolvedConfig.logger.warn(msg)
resolvedConfig.logger.warn(
colors.yellow(`[plugin:uni:app-uvue-css] ${message.text}`)
)
let msg = ''
if (message.line && message.column) {
msg += `\n${generateCodeFrame(source, {
line: message.line,
column: message.column,
}).replace(/\t/g, ' ')}\n`
}
msg += `${formatAtFilename(filename)}`
resolvedConfig.logger.warn(msg)
}
})
return { code: `export default ${code}`, map: { mappings: '' } }
Expand Down

0 comments on commit b521ffe

Please sign in to comment.