Skip to content

Commit bf19144

Browse files
committed
docs(module): fix import script suffix
1 parent b2877ad commit bf19144

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/module.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ foo()
190190

191191
```javascript
192192
// main.js
193-
import {firstName, lastName, year} from './profile';
193+
import {firstName, lastName, year} from './profile.js';
194194

195195
function setName(element) {
196196
element.textContent = firstName + ' ' + lastName;
@@ -202,7 +202,7 @@ function setName(element) {
202202
如果想为输入的变量重新取一个名字,`import`命令要使用`as`关键字,将输入的变量重命名。
203203

204204
```javascript
205-
import { lastName as surname } from './profile';
205+
import { lastName as surname } from './profile.js';
206206
```
207207

208208
`import`后面的`from`指定模块文件的位置,可以是相对路径,也可以是绝对路径,`.js`后缀可以省略。如果只是模块名,不带有路径,那么必须有配置文件,告诉 JavaScript 引擎该模块的位置。

0 commit comments

Comments
 (0)