使用spmbuild来压缩js文件。js使用了seajs,backbone。但是压缩之后的文件,总是缺少对require文件的依赖。如下面的代码就缺少对jquery、underscore的依赖。define("app/test/1.0.0/main-debug",["backbone-debug","./view-debug","./common-debug","./bootstrap-debug","./bootstrap-datetimepicker-debug","./collection-debug","./model-debug","./item-view-debug","./detail-view-debug","./DropDownLoading-debug"],function(require,exports,module){varBackbone=require("backbone-debug");var_=require("underscore-debug");var$=require("$-debug");varapp=require("./view-debug");newapp();});package.json的代码如下:{"family":"app","name":"test","version":"1.0.0","description":"test","homepage":"","author":"","maintainers":[""],"repository":{"type":"git","url":"http://192.168.200.8/group-team/meet.git"},"bugs":{"url":""},"dependencies":{"jquery":"gallery/jquery/1.8.2/jquery"},"keywords":[],"licenses":"MIT","spm":{"alias":{},"output":["main.js"],"devAlias":{},"engines":{}}}哪位朋友遇到过这种问题,麻烦帮忙解答一下。
2 回答
宝慕林4294392
TA贡献2021条经验 获得超8个赞
请在package.json文件中配置spm.alias,制定其他依赖别名与路径。你这样想,使用别名引用了第三方足迹,你不告诉他位置信息,当然是build后文件中是看不到文件的,但好处是使用时可以在项目配置别名,使用项目中路径版本,比如jquery,模块只是说明在使用jquery,具体版本视其环境提供
添加回答
举报
0/150
提交
取消