【问题标题】:Backup Import JS Module备份导入 JS 模块
【发布时间】:2021-02-16 20:05:15
【问题描述】:

我想让一个包成为对等依赖项,如果它不存在,则为其导入的模块备份

import { Bar } from 'foo';

const SafeBar = () => {};

if (Bar === undefined) {
  Bar = SafeBar
}

当我尝试这样做时,这对我来说是错误的

【问题讨论】:

    标签: javascript import module


    【解决方案1】:

    我用 typeof 做了一个三元组

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-01
      • 2020-07-25
      • 2021-12-10
      • 2018-07-02
      • 2019-05-09
      • 2021-03-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多