简体   繁体   中英

_.extend is undefined in js code generated from coffeescript

I have some CoffeeScript code, which is not written by me. I have compiled it to Javascript via a provided Grunt script and manually via coffee --compile my_single_file.coffee . In both cases, the following snippet is generated to loop over a list:

_ref1 = this.baseMap;
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
  c = _ref1[_j];
  o = _.extend(c); 

If I try to use the generated file in my page, the underscore in the last line is undefined. I guess I'm missing some includes, compile flags, ... but I found no hint what it might be. Any hint what I might be doing wrong?

Maybe it depends on something else? Looks like underscore.js although the extend method requires two arguments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM