Skip to content

Commit

Permalink
feat(plugin-compiler): web-pro 编译去除 .json 文件输出
Browse files Browse the repository at this point in the history
  • Loading branch information
hwaphon committed May 6, 2024
1 parent 758f541 commit e9feb46
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/plugin-compiler/src/loaders/configLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default async function ConfigLoader(

const options = this.getOptions()
const { userConfig, entryBuilder, runner } = options
const { compileType, minimize } = userConfig || {}
const { compileType, minimize, target } = userConfig || {}
let entry = entryBuilder.getEntryByFilePath(this.resourcePath)

// 这里拿到的 this.resourcePath 可能和 entryBuilder 中记录的不一致
Expand Down Expand Up @@ -71,9 +71,9 @@ export default async function ConfigLoader(
}

const code = JSON.stringify(json, null, minimize ? 0 : 2)

const isWeb = target === 'web' || target === 'web-pro'
// web 且 bundle 模式下不输出 json 文件
if (!(userConfig.target === 'web' && userConfig.compileMode === 'bundle')) {
if (!(isWeb && userConfig.compileMode === 'bundle')) {
// 生成 json 文件
this.emitFile(fullEntryName, code)
}
Expand Down

0 comments on commit e9feb46

Please sign in to comment.