diff --git a/server/build.go b/server/build.go index ab71b1435..f34050bc7 100644 --- a/server/build.go +++ b/server/build.go @@ -90,13 +90,8 @@ func (task *BuildTask) build() (esm *ESMBuild, err error) { } if task.Target == "types" { - var dts string - if endsWith(task.Pkg.FullSubmodule, ".d.ts", ".d.mts") && !endsWith(task.Pkg.FullSubmodule, "~.d.ts") { - dts = npm.Name + "@" + npm.Version + path.Join("/", task.Pkg.FullSubmodule) - } else if npm.Types != "" { - dts = npm.Name + "@" + npm.Version + path.Join("/", npm.Types) - } - if dts != "" { + if npm.Types != "" { + dts := npm.Name + "@" + npm.Version + path.Join("/", npm.Types) task.stage = "transform-dts" task.buildDTS(dts) } diff --git a/server/build_helpers.go b/server/build_helpers.go index 8dddbfde6..b4b959364 100644 --- a/server/build_helpers.go +++ b/server/build_helpers.go @@ -139,7 +139,7 @@ func (task *BuildTask) analyze() (esm *ESMBuild, npm NpmPackage, reexport string } if pkg.Submodule != "" { - if strings.HasSuffix(pkg.Submodule, ".d.ts") { + if endsWith(pkg.Submodule, ".d.ts", ".d.mts") { if strings.HasSuffix(pkg.Submodule, "~.d.ts") { submodule := strings.TrimSuffix(pkg.Submodule, "~.d.ts") subDir := path.Join(wd, "node_modules", npm.Name, submodule)