-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
Milestone
Description
相同之处
RequireJS 和 Sea.js 都是模块加载器,倡导模块化开发理念,核心价值是让 JavaScript 的模块化开发变得简单自然。
不同之处
两者的主要区别如下:
- 定位有差异。RequireJS 想成为浏览器端的模块加载器,同时也想成为 Rhino / Node 等环境的模块加载器。Sea.js 则专注于 Web 浏览器端,同时通过 Node 扩展的方式可以很方便跑在 Node 环境中。
- 遵循的规范不同。RequireJS 遵循 AMD(异步模块定义)规范,Sea.js 遵循 CMD (通用模块定义)规范。规范的不同,导致了两者 API 不同。Sea.js 更贴近 CommonJS Modules/1.1 和 Node Modules 规范。
- 推广理念有差异。RequireJS 在尝试让第三方类库修改自身来支持 RequireJS,目前只有少数社区采纳。Sea.js 不强推,采用自主封装的方式来“海纳百川”,目前已有较成熟的封装策略。
- 对开发调试的支持有差异。Sea.js 非常关注代码的开发调试,有 nocache、debug 等用于调试的插件。RequireJS 无这方面的明显支持。
- 插件机制不同。RequireJS 采取的是在源码中预留接口的形式,插件类型比较单一。Sea.js 采取的是通用事件机制,插件类型更丰富。
还有不少差异,涉及具体使用方式和源码实现,欢迎有兴趣者研究并发表看法。
总之,如果说 RequireJS 是 Prototype 类库的话,则 Sea.js 致力于成为 jQuery 类库。
最重要的
最后,向 RequireJS 致敬!RequireJS 和 Sea.js 是好兄弟,一起努力推广模块化开发思想,这才是最重要的。
更新
- 2013.06.30 推荐一篇图片并茂的文章:Sea.js 与 RequireJS 最大的区别
参考
- LABjs、RequireJS、Sea.js 哪个最好用?为什么?
- 从 RequireJS 到 Sea.js 系列:(1) (2) (3) (4) (5) (要翻墙)
- Sea.js 和 RequireJS 的异同(要翻墙)
- AMD 与 CMD 的区别
PoisonalLong, navcat, Seasons123, FightingDao, kawhi66 and 8 more
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
Select code repository
Activity
lifesinger commentedon Jul 11, 2012
有任何问题,欢迎留言交流。
注意:已解决的问题,会在整理后删除掉。
ufologist commentedon Jun 20, 2013
SeaJS与RequireJS最大的区别
执行模块的机制大不一样
SeaJS对模块的态度是懒执行, 而RequireJS对模块的态度是预执行
lifesinger commentedon Jun 21, 2013
@ufologist 嗯,推荐的文章真好,图文并茂。
wxg315699 commentedon Feb 18, 2014
推荐的图文并茂的文章有坑啊,现象确实是那么个现象,可是结论。。。实在不敢恭维
binggg commentedon Jun 4, 2014
as lazy as possible
zhishaofei3 commentedon Jun 7, 2014
nocache、debug 在哪找啊?
afc163 commentedon Jun 7, 2014
https://github.com/seajs/seajs-debug @zhishaofei3
zhishaofei3 commentedon Jun 7, 2014
@afc163 谢谢
mycoin commentedon Jun 13, 2014
习惯使用 require.config配置, 并且只有两个命名空间的Loader,个人性格问题~
army8735 commentedon Jun 13, 2014
@mycoin
两个命名空间是指?require和define?
seajs也是2个:seajs和define。
习惯问题的话其实简单:var require = seajs;delete seajs
mycoin commentedon Jun 13, 2014
@army8735 对的,因为使用标准的 require, define 可以在requireJS, esl, 等随意切换,这样也使得我的模块可以被所有类型的loader使用。
个人感觉这样才Common
13 remaining items
DarrenMan commentedon Mar 1, 2016
视自己需求而定吧
demox2026 commentedon Nov 13, 2016
能否结合ES6再来对比下呢
mygaochunming commentedon May 12, 2017
@lifesinger
从 RequireJS 到 Sea.js 系列:1~3打不开,是文章地址修改了吗?希望能够拜读一下
dhlolo commentedon Sep 15, 2022
用CMD同步的思路去处理异步问题:
summerhll commentedon Sep 15, 2022
gt333 commentedon Sep 15, 2022