```
(2)然后再在JS文件中使用define定义模块,如下:
```
define(function(require,exports,module){
//模块代码
});
```
(3)模块依赖:
在使用seajs时,模块依赖关系需要通过require方式来定义。
如下所示,在b中需要使用a模块的功能,就需要在b中引入" alt="掌握前端开发必备神器——深入了解seajs模块化开发方式" class="img img_hover" />
```
然后通过require函数加载需要的模块,如:
```js
require(['module1', 'module2'], function(module1, module2) {
// 模块加载成功后执行的回调函数
module1.doSomething();
module2.doSomething();
});
```
" alt="JavaScript模块管理利器:RequireJS原理及使用教程" class="img img_hover" />