按需获取的动态 import. 该类函数格式(并非继承 Function.prototype)返回 promise 函数

    1. {
    2. const modulePage = "page.js";
    3. import(modulePage).then((module) => {
    4. module.init();
    5. });
    6. }
    7. {
    8. (async () => {
    9. const helpersModule = "helpers.js";
    10. const module = await import(helpersModule);
    11. const total = module.sum(2, 2);
    12. })();
    13. }