Skip to content

Commit

Permalink
Merge pull request #24 from chriswong/master
Browse files Browse the repository at this point in the history
ECMAScript 大小写及示例代码修正
  • Loading branch information
zhaoda committed Apr 30, 2017
2 parents 9f3fa0e + 7d76f08 commit 015557f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions content/amd.md
Expand Up @@ -30,7 +30,7 @@ define('myModule', ['jquery'], function($) {
$('body').text('hello world');
});
// 使用
define(['myModule'], function(myModule) {});
require(['myModule'], function(myModule) {});
```
注意:在 webpack 中,模块名只有局部作用域,在 Require.js 中模块名是全局作用域,可以在全局引用。
Expand Down Expand Up @@ -73,4 +73,4 @@ define(function(require) {
var $ = require('jquery');
$('body').text('hello world');
});
```
```
8 changes: 2 additions & 6 deletions content/module-system.md
Expand Up @@ -114,7 +114,7 @@ define(function(require, exports, module) {

### ES6 模块

EcmaScript6 标准增加了 JavaScript 语言层面的模块体系定义。[ES6 模块](http://es6.ruanyifeng.com/#docs/module)的设计思想,是尽量的静态化,使得编译时就能确定模块的依赖关系,以及输入和输出的变量。CommonJS 和 AMD 模块,都只能在运行时确定这些东西。
ECMAScript6 标准增加了 JavaScript 语言层面的模块体系定义。[ES6 模块](http://es6.ruanyifeng.com/#docs/module)的设计思想,是尽量的静态化,使得编译时就能确定模块的依赖关系,以及输入和输出的变量。CommonJS 和 AMD 模块,都只能在运行时确定这些东西。

```js
import "jquery";
Expand All @@ -125,7 +125,7 @@ module "localModule" {}
优点:

- 容易进行静态分析
- 面向未来的 EcmaScript 标准
- 面向未来的 ECMAScript 标准

缺点:

Expand Down Expand Up @@ -172,7 +172,3 @@ require("./image.png");
同时,为了能利用已经存在的各种框架、库和已经写好的文件,我们还需要一个模块加载的兼容策略,来避免重写所有的模块。

那么接下来,让我们开始 Webpack 的神奇之旅吧。




0 comments on commit 015557f

Please sign in to comment.