Browse Source

handle scripts that have source map comments pointing to no real files

pull/113/head
mattdesl 5 years ago
parent
commit
a804efd66d
  1. 18
      lib/require-hook.js
  2. 2
      package.json

18
lib/require-hook.js

@ -72,12 +72,18 @@ module.exports = function requireHook (opts) {
// if we have a map pointing to a file, inline it as base64
if (!hasComment && hasMapFile) {
var sm = convertSourceMap.fromMapFileSource(original, sourceFileDir);
script = [
combineSourceMap.removeComments(script),
convertSourceMap.fromObject(sm.sourcemap).toComment()
].join('\n');
hasComment = true; // now we have base64 comment
try {
var sm = convertSourceMap.fromMapFileSource(original, sourceFileDir);
script = [
combineSourceMap.removeComments(script),
convertSourceMap.fromObject(sm.sourcemap).toComment()
].join('\n');
hasComment = true; // now we have base64 comment
} catch (err) {
// Don't attempt to handle source maps for this file,
// it is most likely a comment about source maps and not
// a *real* source map comment!
}
}
var wrapScript = moduleWrap(script);

2
package.json

@ -16,7 +16,7 @@
"concat-stream": "^1.5.1",
"convert-source-map": "^1.2.0",
"deep-extend": "^0.4.1",
"electron": "1.4.3",
"electron": "1.4.15",
"events": "^1.1.0",
"mime": "^1.3.4",
"minimist": "^1.2.0",

Loading…
Cancel
Save