diff --git a/packages/uni-cli-shared/lib/source-map.js b/packages/uni-cli-shared/lib/source-map.js index e1ae49714471a1b13ade9ad47c4ec65d7fb7b668..939c8062e6bdbe29d89987d9163ee4d0533f4797 100644 --- a/packages/uni-cli-shared/lib/source-map.js +++ b/packages/uni-cli-shared/lib/source-map.js @@ -28,7 +28,14 @@ function getSourceRoot () { } function moduleFilenameTemplate (info) { - if (!info.allLoaders && info.resourcePath) { + if ( + info.resourcePath && + ( + !info.allLoaders || + info.query.includes('type=script&lang=ts') || + info.resourcePath.endsWith('.ts') + ) + ) { const filepath = normalizePath(path.relative(getSourceRoot(), info.absoluteResourcePath)) if (filepath.indexOf('../') === 0) { return