Skip to content
Permalink
Browse files
Build: Fix the regex parsing AMD var-modules (#4389)
The previous regex caused the final jQuery binary to have syntax errors for
var-modules with names starting with "return". For example, the following module
wouldn't work when the file is named `returnTrue.js`:

```js
define( function() {
	"use strict";
	return function returnTrue() {
		return true;
	};
} );
```

Closes gh-4389

(cherry picked from commit 9ec09c3)
  • Loading branch information
mgol committed Sep 25, 2019
1 parent 30f5c6c commit 36b59c9661b7c24bb0271f813d2a02cac44de81a
Showing 1 changed file with 1 addition and 1 deletion.
@@ -65,7 +65,7 @@ module.exports = function( grunt ) {
if ( /.\/var\//.test( path.replace( process.cwd(), "" ) ) ) {
contents = contents
.replace(
/define\([\w\W]*?return/,
/define\(\s*(["'])[\w\W]*?\1[\w\W]*?return/,
"var " +
( /var\/([\w-]+)/.exec( name )[ 1 ] ) +
" ="

0 comments on commit 36b59c9

Please sign in to comment.