懒加载-动态导入 father:: ES6模块化 ES module base:: esm 导出模块结构
梗概
只有程序运行到这一句代码, 才会去导入 这样可以提升代码运行效率
示例
child::
child::esm动态导入默认导出
示例
export default remarkParse
指向原始笔记的链接
- 动态导入为
const remarkParse = (await import("remark-parse")).default;
esm动态导入普通导出
示例
export {unified} from './lib/index.js'
指向原始笔记的链接
- 动态导入为
const { unified } = await import("unified");