Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grunt工具使用疑惑 #763

Closed
pengfeiWang opened this issue Jun 4, 2013 · 4 comments
Closed

grunt工具使用疑惑 #763

pengfeiWang opened this issue Jun 4, 2013 · 4 comments

Comments

@pengfeiWang
Copy link

构建前

define(function ( require, exports, module ){
    var G = require('global');
    var Comments = require('comment');
})

构建后

define("pro-res/js/init", [ "global", "comment" ], function(require, exports, module) {

});

(1) define(), 第一个参数是否要绝对路径, 看起来没有构建前的代码清晰, 而且, require也被缩减了, 不知道是否有影响, 另外sea根据文件自身加载模块, 这样的话是否不需改动就可以加载到模块
(2) define(), 第一个参数根据什么生成
(3) 构建后的文件下会多个src目录, 在配置中是否可以不生成这个目录,
(4) 有些模块不想合并, 有些要合并, 想请指点下合并策略, 该如何配置
(5) 怎么能不创建 带 -debug的文件呢,貌似这样

 options:{  debug: false }

经过尝试:

(2) define(), 第一个参数根据options生成, 不知是否正确

options : {
    idleading : 'static/project/pro-res/'
}

(3) src这个目录不在生成了, 不过还是不知道如何消失的, 不能重现了, 悲剧

刚刚接触seajs, 有一些问题应该是很幼稚, 见笑了

@antife-yinyue
Copy link
Contributor

@oliverNote12

  1. define的第一个参数是模块标识,参见 模块标识 #258 require被压缩了没关系
  2. 目前都是用Grunt自主构建,规则随你定,只要最终能转换为http路径,能被访问到即可。你说的没错,就是通过idleading配置前缀
  3. src理应不会自动冒出来,肯定你哪边的配置写了,检查下你的Gruntfile
  4. 可以给transport task 配置 alias 时,直接传入 alias的key,比如'$': '$'
  5. you are right

@pengfeiWang
Copy link
Author

@jsw0528 感谢回复
还有一点没理解

  1. 目前都是用Grunt自主构建,规则随你定,只要最终能转换为http路径,能被访问到即可
    (不小心敲回车发出来了,及时更改)
    只要最终转换为http路径, 是不是可以这样理解, id 就是路径

@lifesinger
Copy link
Member

解析后 id 就是路径,比如 "pro-res/js/init" 会被解析成 "http://path/to/base/pro-res/js/init"

@dahai300
Copy link

也遇到了同样问题,@pengfeiWang ,你是怎么解决的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants