Converting })(function($, undefined) {
into }(function ($, undefined) ) {
is erroneous because you need to move the {} inside the parentheses as well, like so:
(function() {
...
}(function() { ... }));
With regards to the undefined errors you're getting, just put this comment at the top of your JS file:
/*global define, module, exports*/
Feel free to add some other common variables if you need to exclude them as well:
/*global define, module, exports, document, window, alert, console, require*/
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…