Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Commit

Permalink
ensure we match all System._nodeRequire replacements
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Aug 26, 2015
1 parent bf96fd0 commit eb63a85
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compilers/cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,11 @@ exports.compile = function(load, opts, loader) {

var output = compiler.write(tree, load.address);

// replace System._nodeRequire with $__System, ensuring we don't replace an existing $__System
if (opts.sfx)
output = output.replace(/System\._nodeRequire/g, '$__System._nodeRequire');
output = output.replace(/(^|[^_])System\._nodeRequire/g, function(match, startArg) {
return startArg + '$__System._nodeRequire';
});

return Promise.resolve({
source: output,
Expand Down

0 comments on commit eb63a85

Please sign in to comment.