Skip to content

require 模块失败后,再次 require 该模块不会重新加载 #78

@ghost

Description

问题描述:esl 环境中,在断网的情况下 require 模块失败,在连网后再次触发 require 该模块 不会触发该模块的加载。

通过阅读esl源码,个人认为问题原因为:无论模块加载成功与否,loadingModules[moduleId1] 都会赋值为 1,导致即使后来再次 require([moduleId1]) 也不会进入到新建 script 加载的逻辑。
b3342b8d4424eeb44a9866869

建议: 在此挂接 onerror 的错误处理,重新赋值 loadingModules[moduleId1] 为 0,使得加载某个模块失败后,还能重新加载该模块。
6efd7efdb7ff3ea797adcf437

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions