From fa3d724b73408356a19c03c4530a6aa671eac096 Mon Sep 17 00:00:00 2001 From: VHall1 Date: Mon, 18 Dec 2023 05:25:20 +0000 Subject: [PATCH 1/4] fix (remix-serve): convert file url to path when loading source maps --- packages/remix-serve/cli.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/remix-serve/cli.ts b/packages/remix-serve/cli.ts index 079bad13d61..d741647d0e7 100644 --- a/packages/remix-serve/cli.ts +++ b/packages/remix-serve/cli.ts @@ -20,12 +20,13 @@ process.env.NODE_ENV = process.env.NODE_ENV ?? "production"; sourceMapSupport.install({ retrieveSourceMap: function (source) { - // get source file without the `file://` prefix or `?t=...` suffix - let match = source.match(/^file:\/\/(.*)\?t=[.\d]+$/); + // get source file with the `file://` prefix + let match = source.match(/^file:\/\/(.*)$/); if (match) { + let filePath = url.fileURLToPath(source); return { url: source, - map: fs.readFileSync(`${match[1]}.map`, "utf8"), + map: fs.readFileSync(`${filePath}.map`, "utf8"), }; } return null; From 56ce7c2760ae37e071280eb2a9be903e3140b08f Mon Sep 17 00:00:00 2001 From: VHall1 Date: Mon, 18 Dec 2023 05:26:31 +0000 Subject: [PATCH 2/4] fix (templates): apply source map fix to express template --- templates/express/server.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/templates/express/server.js b/templates/express/server.js index b66f6daf084..0533f94dc28 100644 --- a/templates/express/server.js +++ b/templates/express/server.js @@ -11,12 +11,13 @@ import sourceMapSupport from "source-map-support"; sourceMapSupport.install({ retrieveSourceMap: function (source) { - // get source file without the `file://` prefix or `?t=...` suffix - const match = source.match(/^file:\/\/(.*)\?t=[.\d]+$/); + // get source file with the `file://` prefix + const match = source.match(/^file:\/\/(.*)$/); if (match) { + const filePath = url.fileURLToPath(source); return { url: source, - map: fs.readFileSync(`${match[1]}.map`, "utf8"), + map: fs.readFileSync(`${filePath}.map`, "utf8"), }; } return null; From 27630a4c37899363b394240cdbc4a1ad567bfd8f Mon Sep 17 00:00:00 2001 From: VHall1 Date: Mon, 18 Dec 2023 05:36:43 +0000 Subject: [PATCH 3/4] add to contributors --- contributors.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/contributors.yml b/contributors.yml index e3794c92761..14b80999999 100644 --- a/contributors.yml +++ b/contributors.yml @@ -623,3 +623,4 @@ - timkraut - alexanderson1993 - signed +- VHall1 From 899e6b7d6f8087f0c795a62bd30e6b4ab8c61209 Mon Sep 17 00:00:00 2001 From: VHall1 Date: Mon, 18 Dec 2023 05:41:46 +0000 Subject: [PATCH 4/4] add changeset --- .changeset/angry-poets-accept.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/angry-poets-accept.md diff --git a/.changeset/angry-poets-accept.md b/.changeset/angry-poets-accept.md new file mode 100644 index 00000000000..0454cf765d6 --- /dev/null +++ b/.changeset/angry-poets-accept.md @@ -0,0 +1,5 @@ +--- +"@remix-run/serve": patch +--- + +Use node `fileURLToPath` to convert source map URL to path