1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-24 10:22:23 +00:00

docs(module-loader): fix typo

This commit is contained in:
ruanyf 2020-08-29 11:24:38 +08:00
parent 2613635b77
commit adb49644ad

View File

@ -519,7 +519,7 @@ export const foo = cjsModule.foo;
上面代码先整体输入 CommonJS 模块,然后再根据需要输出具名接口。
你可以把这个文件的后缀名改为`.mjs`,或者将它放在一个子目录,再在这个子目录里面放一个单独的`package.json`文件,指明`{ module: "type" }`。
你可以把这个文件的后缀名改为`.mjs`,或者将它放在一个子目录,再在这个子目录里面放一个单独的`package.json`文件,指明`{ type: "module" }`。
另一种做法是在`package.json`文件的`exports`字段,指明两种格式模块各自的加载入口。