Skip to content

Commit

Permalink
fix: tsLoaderOptions transpileOnly with HBuilderX
Browse files Browse the repository at this point in the history
  • Loading branch information
zhetengbiji committed Nov 15, 2022
1 parent 7fdfda9 commit 18fbdd9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/vue-cli-plugin-uni/lib/configure-webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,11 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
function removeForkTsCheckerWebpackPlugin (rawPlugins) {
if (isInHBuilderX && hasModule('fork-ts-checker-webpack-plugin')) {
const pluginIndex = rawPlugins.findIndex(rawPlugin => rawPlugin.vue && rawPlugin.typescriptVersion)
if (pluginIndex !== -1) { // 移除fork-ts-checker-webpack-plugin
if (pluginIndex !== -1) {
// 移除fork-ts-checker-webpack-plugin
rawPlugins.splice(pluginIndex, 1)
// 恢复vue-loader的ts检查
tsLoaderOptions.transpileOnly = false
}
}
}
Expand Down Expand Up @@ -215,6 +218,8 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
}
}

// 如果在 HBuilderX 中
removeForkTsCheckerWebpackPlugin(webpackConfig.plugins)
// js preprocess
updateJsLoader(rawRules, 'foo.js', babelLoaderRe, {
loader: resolve('packages/webpack-preprocess-loader'),
Expand All @@ -229,8 +234,6 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
loader: resolve('packages/webpack-preprocess-loader'),
options: jsPreprocessOptions
})
// 如果在 HBuilderX 中
removeForkTsCheckerWebpackPlugin(webpackConfig.plugins)

let platformWebpackConfig = platformOptions.webpackConfig
if (typeof platformWebpackConfig === 'function') {
Expand Down

0 comments on commit 18fbdd9

Please sign in to comment.