From 0f4f77f8a20f34a035cfd2bce57041bfe170877f Mon Sep 17 00:00:00 2001 From: David Greenspan Date: Mon, 29 Sep 2014 12:10:11 -0700 Subject: [PATCH] Fix #2627 (source maps with a PATH_PREFIX) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When you set ROOT_URL_PATH_PREFIX, source maps are not found because the server serves them at a different path from where the client looks for them. I don’t understand this code super well, but based on what’s reported in issue #2627, the new code seems strictly more correct than the old code. --- packages/webapp/webapp_server.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/webapp/webapp_server.js b/packages/webapp/webapp_server.js index 41f1128fb7..d80665c872 100644 --- a/packages/webapp/webapp_server.js +++ b/packages/webapp/webapp_server.js @@ -424,8 +424,11 @@ WebAppInternals.staticFilesMiddleware = function (staticFiles, req, res, next) { // // You may also need to enable source maps in Chrome: open dev tools, click // the gear in the bottom right corner, and select "enable source maps". - if (info.sourceMapUrl) - res.setHeader('X-SourceMap', info.sourceMapUrl); + if (info.sourceMapUrl) { + res.setHeader('X-SourceMap', + __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + + info.sourceMapUrl); + } if (info.type === "js") { res.setHeader("Content-Type", "application/javascript; charset=UTF-8");