简体   繁体   English

与SquishIt捆绑Browsery时出现错误

[英]Getting errors when Browsery bundle with SquishIt

I am currently refactoring the javascript portions of a web site, and now I have bundled some scripts together using Browserify. 我目前正在重构网站的javascript部分,现在我已经使用Browserify将一些脚本捆绑在一起。 The resulting script is bundled along with other resources using SquishIt. 使用SquishIt将生成的脚本与其他资源捆绑在一起。 In Debug mode, when SquishIt is not bundling all the scripts together everything seems to work just fine, but when running in Production, and SquishIt bundles everything together I get errors from the Browserify part of my bundle. 在Debug模式下,当SquishIt没有将所有脚本捆绑在一起时,一切似乎都工作正常,但是在Production中运行时,SquishIt将所有东西捆绑在一起,我从捆绑中的Browserify部分得到了错误。 The error is complaining that r has no length property (see line 18) below. 该错误表明r在下面没有长度属性(请参见第18行)。 This part of the code is created by Browserify when bundling the scripts. 捆绑脚本时,这部分代码由Browserify创建。

(function e(t, n, r) { function s(o, u) { if (!n[o]) { if (!t[o]) { var a = typeof require == "function" && require; if (!u && a) return a(o, !0); if (i) return i(o, !0); var f = new Error("Cannot find module '" + o + "'"); throw f.code = "MODULE_NOT_FOUND", f } var l = n[o] = { exports: {} }; t[o][0].call(l.exports, function(e) { var n = t[o][1][e]; return s(n ? n : e) }, l, l.exports, e, t, n, r) } return n[o].exports } var i = typeof require == "function" && require; for (var o = 0; o < r.length; o++) s(r[o]); return s })({

I really can't think of anything that using SquishIt to bundle all the scripts would break the logic of the browserified scripts. 我真的想不出使用SquishIt捆绑所有脚本会破坏浏览器化脚本的逻辑的任何事情。 What could be the cause of this? 这可能是什么原因? This gist shows the entire source code, in case that is relevant. 如果需要的话,本要点显示了整个源代码。

I have not changed anything on the ASP.NET side (in the bundling), and the relevant part of my ´Head.ascx´ looks like this: 我没有在ASP.NET方面进行任何更改(在捆绑中),“ Head.ascx”的相关部分如下所示:

 Bundle.JavaScript() 
 .Add(Assets.JavaScript.GetUrl("main.js").ToString()) 
 .Add(Assets.JavaScript.GetUrl("Plugins/raphael-min.js").ToString()) 
 .Add(Assets.JavaScript.GetUrl("Plugins/vector_map.js").ToString()) 
 // more ...
 .Render("~/Content/"+Assets.VersionString+"/Scripts/Combined/combined.js")

Have a look at this comment it may help https://github.com/jetheredge/SquishIt/issues/320#issuecomment-139921409 看看这个评论可能会有所帮助https://github.com/jetheredge/SquishIt/issues/320#issuecomment-139921409

Is there a reason you need to use two different bundling solutions? 您是否有理由需要使用两种不同的捆绑解决方案?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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