bug:export 'default' (imported as 'd3') was not found in 'd3'

BUG

在项目中遇到了一个令人困惑的bug:

export 'default' (imported as 'd3') was not found in 'd3'

我的写法如下

import d3 from 'd3'

后面引用d3的方法,都会显示d3为undefined。

解决之道

方法1:

改变import 写法

import * as d3 from 'd3'

方法2:

升级d3版本,最好使用v4以上版本

你可能感兴趣的:(bug:export 'default' (imported as 'd3') was not found in 'd3')