Skip to content

Commit 857c4f2

Browse files
authored
Merge pull request ruanyf#648 from KinFeng/patch-1
fs的接口应该是readFile,'f'改成大写'F'
2 parents b48a35b + da319a1 commit 857c4f2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/module-loader.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,10 @@ setTimeout(_ => module.exports = null);
426426

427427
```javascript
428428
// 不正确
429-
import { readfile } from 'fs';
429+
import { readFile } from 'fs';
430430
```
431431

432-
上面的写法不正确,因为`fs`是 CommonJS 格式,只有在运行时才能确定`readfile`接口,而`import`命令要求编译时就确定这个接口。解决方法就是改为整体输入。
432+
上面的写法不正确,因为`fs`是 CommonJS 格式,只有在运行时才能确定`readFile`接口,而`import`命令要求编译时就确定这个接口。解决方法就是改为整体输入。
433433

434434
```javascript
435435
// 正确的写法一

0 commit comments

Comments
 (0)