我的代码使用了requirejs来做依赖管理,并使用grunt-contrib-requirejs做了打包。js分为了libs,utils,app三个文件夹,分别存放通用js,组件,私有启动js文件。配置部分如下:requirejs:{build:{options:{appDir:'./dev',baseUrl:'js',dir:'./build',optimize:'uglify2',generateSourceMaps:true,preserveLicenseComments:false,//useSourceUrl:true,optimizeCss:'standard.keepComments.keepLines',paths:{'jquery':'libs/jquery-1.8.2','a':'utils/a','b':'utils/b','c':'utils/c','d':'utils/d','e':'utils/e','de':'app/de'},shim:{},modules:[{name:'de'}]}}}现在的问题是,作为要被打包的de.js(app下的启动文件,依赖了一些组件),只是打包生成了其对应的map文件,混淆压缩文件,缺少对应的文件src.js(混淆压缩之前的文件copy)。请问我配置哪里出了问题呢?另外,提供了github地址:https://github.com/xiaomingming/requirejs-package。请指点。
2 回答
至尊宝的传说
TA贡献1789条经验 获得超10个赞
我gruntfile的require的配置requirejs:{compile:{options:{optimize:"none",generateSourceMaps:false,//publish任务时不可以将generateSourceMaps配置项打开preserveLicenseComments:false,useSourceUrl:true,baseUrl:"resource/js",mainConfigFile:'resource/js/app.js',name:"app",out:"resource/js/r.app.js"}}}---------------app.js的内容---------------require.config({baseUrl:"resource/js",paths:{"main":"app","jquery":"jquery/jquery-2.1.1.min","angular":"angular/angular","bootstrap":"bootstrap/bootstrap.min","ocLazyLoad":"plugins/oclazyload/dist/ocLazyLoad.min","ui-router":"ui-router/angular-ui-router.min","ui-bootstrap":"bootstrap/ui-bootstrap-tpls-0.12.0.min","notify":"plugins/angular-notify/angular-notify.min","icheck":"plugins/iCheck/icheck.min"},shim:{"angular":{exports:"angular"},"ocLazyLoad":{deps:["angular"]},"ui-router":{deps:["angular"]},"ui-bootstrap":{deps:["angular"]},"notify":{deps:["angular"]},"icheck":{deps:["angular"]}}});require(["angular","main/app","main/param","main/service","main/config","main/directives","main/controllers"],function(angular){angular.bootstrap(document,["mlp"]);});直行gruntrequire//这样可以打包合并的希望可以帮到题主,哦我是用的grunt-requirejs不过语法应该也是差不多的
添加回答
举报
0/150
提交
取消