Skip to content

Commit

Permalink
Merge pull request #661 from gyz0072004/fix-loader
Browse files Browse the repository at this point in the history
fix(loader): fix logic when no compilerOptions passed by webpack
  • Loading branch information
Brooooooklyn committed Jun 20, 2022
2 parents d9ff756 + 8cc36ab commit 9993917
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/loader/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export function loader(
) {
const callback = this.async()
const { compilerOptions, configFile, fastRefresh } = this.getOptions() ?? {}
const options = convertCompilerOptionsFromJson(compilerOptions, '').options ?? readDefaultTsConfig(configFile)
const { options: assignedOptions } = convertCompilerOptionsFromJson(compilerOptions, '')
const options =
!assignedOptions || Object.keys(assignedOptions).length === 0 ? readDefaultTsConfig(configFile) : assignedOptions
const swcOptions = tsCompilerOptionsToSwcConfig(options, this.resourcePath)
if (fastRefresh) {
if (swcOptions.react) {
Expand Down

0 comments on commit 9993917

Please sign in to comment.