From 46a12fdb8ac36db7ace0fdf1929e1b25600ccce7 Mon Sep 17 00:00:00 2001 From: Joel Einbinder Date: Fri, 1 Oct 2021 08:16:05 -0400 Subject: [PATCH] fix(sourcemap): accept a sourceMappingURL that ends with a newline (#45983) * fix(sourcemap): accept a sourceMappingURL that ends with a newline * Update src/compiler/sourcemap.ts Co-authored-by: Wesley Wigham --- src/compiler/sourcemap.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index ed75cf081d9..e3aebc849b6 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -322,7 +322,8 @@ namespace ts { } // Sometimes tools can see the following line as a source mapping url comment, so we mangle it a bit (the [M]) - const sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)$/; + const sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)\r?\n?$/; + const whitespaceOrMapCommentRegExp = /^\s*(\/\/[@#] .*)?$/; export interface LineInfo {