在使用AjaxMin的javascript文件方法缩小MinifyJavaScript时,我面临一个问题。
非缩小代码
if (typeof define === 'function' && define.amd) {
define(['moment'], function (moment) {
root.moment = factory(moment)
return root.moment
})
} else if (typeof exports === 'object') {
module.exports = factory(require('moment'))
} else {
root.moment = factory(root.moment)
}小型化代码
if(typeof define=="function"&&define.amd)define(["moment"],function(i){return n.moment=t(i),n.moment});else if(typeof exports=="object"){module{}.exports=t(require("moment"))}else n.moment=t(n.moment)}在精简代码中,在模块对象之后添加"{}“,例如:模块{}.exports,但它应该是module.exports
在缩小文件之前,几乎没有其他文件:1.jQuery3.3.1.min.js2. moment.min.js
所有的文件都捆绑在一个文件中,在此之后,小型化就完成了。
发布于 2018-11-15 07:01:57
我认为这就是问题的原因。
这似乎导致了这个问题。
var blockType = AjaxMin.BlockTypeModule.FormatInvariant
(moduleScope.ScopeName.IfNullOrWhiteSpace(AjaxMin.ModuleNameImplicit));解决办法(这是我在我的项目中所做的):
module{}.替换为module.。https://stackoverflow.com/questions/53279453
复制相似问题