mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Serve sources as well, and use X-SourceMap header.
Source maps now work in Chrome, if you enable them (dev tools -> gears button -> enable source maps). I can't get them to work in FF 24 though.
This commit is contained in:
@@ -245,6 +245,15 @@ var runWebAppServer = function () {
|
||||
};
|
||||
// Send the SourceMap header when the source file is served.
|
||||
staticFile.sourceMap = sourceMapRootUrl;
|
||||
|
||||
// Now register all the sources from this source map to be served, under
|
||||
// the source map's URL.
|
||||
_.each(item.sources, function (x, pathForSourceMap) {
|
||||
staticFiles[sourceMapRootUrl + pathForSourceMap] = {
|
||||
path: x.source,
|
||||
cacheable: true
|
||||
};
|
||||
});
|
||||
}
|
||||
staticFiles[url.parse(item.url).pathname] = staticFile;
|
||||
}
|
||||
@@ -293,7 +302,9 @@ var runWebAppServer = function () {
|
||||
|
||||
// Tell the client where to find the source map for this file.
|
||||
if (info.sourceMap) {
|
||||
res.setHeader('SourceMap', info.sourceMap);
|
||||
// This should just be SourceMap, but slightly more browsers support the
|
||||
// older X-SourceMap.
|
||||
res.setHeader('X-SourceMap', info.sourceMap);
|
||||
}
|
||||
|
||||
send(req, path.join(clientDir, info.path))
|
||||
|
||||
@@ -902,7 +902,16 @@ _.extend(ClientTarget.prototype, {
|
||||
data: new Buffer(file.sourceMap.toString(), 'utf8')
|
||||
});
|
||||
|
||||
// XXX write sources too
|
||||
manifestItem.sources = {};
|
||||
_.each(file.sources, function (x, pathForSourceMap) {
|
||||
manifestItem.sources[pathForSourceMap] = {
|
||||
package: x.package,
|
||||
sourcePath: x.sourcePath,
|
||||
source: builder.writeToGeneratedFilename(
|
||||
path.join('sources', pathForSourceMap),
|
||||
{ data: x.source })
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
manifest.push(manifestItem);
|
||||
|
||||
Reference in New Issue
Block a user