From 9bd582ce58536e82f29ea681b61dc08727b8234c Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Mon, 14 Sep 2020 20:46:06 +0800 Subject: [PATCH] fix(cli): TypeScript with SourceMap #2120 --- packages/uni-cli-shared/lib/source-map.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/uni-cli-shared/lib/source-map.js b/packages/uni-cli-shared/lib/source-map.js index e1ae49714..939c8062e 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 -- GitLab