Fix #2627 (source maps with a PATH_PREFIX)

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.
This commit is contained in:
David Greenspan
2014-09-29 12:10:11 -07:00
parent 120e82665e
commit 0f4f77f8a2

View File

@@ -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");