Skip to content

Commit 59a9c8c

Browse files
committed
Fixes #929, uglify's addFile declaration and 0.10/0.12 nodes
1 parent fd1f9a8 commit 59a9c8c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

build/jslib/uglifyjs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9075,7 +9075,7 @@ exports.minify = function(files, options, name) {
90759075
if (options.spidermonkey) {
90769076
toplevel = AST_Node.from_mozilla_ast(files);
90779077
} else {
9078-
function addFile(file, fileUrl) {
9078+
var addFile = function(file, fileUrl) {
90799079
var code = options.fromString
90809080
? file
90819081
: rjsFile.readFile(file, "utf8");

build/jslib/uglifyjs/combine.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ exportContents = exportContents.replace(/UglifyJS\./g, '');
3131
exportContents = exportContents.replace('exports.minify = function(files, options) {', 'exports.minify = function(files, options, name) {');
3232
exportContents = exportContents.replace('filename: options.fromString ? i : file,', 'filename: options.fromString ? name : file,');
3333

34+
// Node 0.10/0.12 do not like the addFile function declaration with the "use strict"
35+
// that is used near that declaration, but not at the top of the file.
36+
// https://github.com/requirejs/r.js/pull/929
37+
exportContents = exportContents.replace(/function addFile\(/, 'var addFile = function(');
38+
3439
fs.writeFileSync(__dirname + '/../uglifyjs.js', [
3540
pre,
3641
raw,

0 commit comments

Comments
 (0)