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

[框架工程项目] 18.模块化开发怎么做? #841

Open
qiilee opened this issue Nov 28, 2019 · 0 comments
Open

[框架工程项目] 18.模块化开发怎么做? #841

qiilee opened this issue Nov 28, 2019 · 0 comments

Comments

@qiilee
Copy link
Member

qiilee commented Nov 28, 2019

答案:

  • AMD 是 RequireJS 在推广过程中对模块定义的规范化产出。

  • CMD 是 SeaJS 在推广过程中对模块定义的规范化产出。

  • AMD 是提前执行,CMD 是延迟执行。

  • AMD 推荐的风格通过返回一个对象做为模块对象,CommonJS 的风格通过对 module.exports 或 exports 的属性赋值来达到暴露模块对象的目的。

CMD 模块方式

define(function(require, exports, module) {
  // 模块代码
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant