Incubator-echarts: "export 'default' (imported as 'ECharts') was not found in 'echarts/lib/echarts.js'

Created on 9 Nov 2017  ·  17Comments  ·  Source: apache/incubator-echarts


./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./~/vue-echarts-v3/src/lite.vue
9:23-30 "export 'default' (imported as 'ECharts') was not found in 'echarts/lib/echarts.js'

ReferenceError: __DEV__ is not defined
at Function.RootClass.extend (clazz.js?5d95:66)
at eval (Component.js?59e6:23)
at Object.1262 (11.js:517)
at __webpack_require__ (app.js:689)
at fn (app.js:110)
at eval (Global.js?c7d4:1)
at Object.1545 (11.js:1481)
at __webpack_require__ (app.js:689)
at fn (app.js:110)
at Object.eval (echarts.js?b1b4:1)
Uncaught (in promise) ReferenceError: __DEV__ is not defined
at Function.RootClass.extend (clazz.js?5d95:66)
at eval (Component.js?59e6:23)
at Object.1262 (11.js:517)
at __webpack_require__ (app.js:689)
at fn (app.js:110)
at eval (Global.js?c7d4:1)
at Object.1545 (11.js:1481)
at __webpack_require__ (app.js:689)
at fn (app.js:110)
at Object.eval (echarts.js?b1b4:1)

One-line summary [问题简述]

Version & Environment [版本及环境]

  • ECharts version: ECharts 3.8.0
  • Browser version: google chrome Version 62.0.3202.89 (Official Build) (64-bit)
  • OS Version: Ubuntu 14.04.5 LTS
    Node Version: 7.10.0
    NPM Version: 4.2.0
    Webpack version: 2.7.0

Expected behaviour [期望结果]

ECharts option [ECharts配置项]


using the gauge option in vue-echarts-v3:

Most helpful comment

我们在新发布的 3.8.2 中将 lib 下的重新转译成了 CommonJS 格式,应该解决了大家构建的兼容问题。非常抱歉新版本的模块系统给大家造成了这么大的麻烦。

All 17 comments

我也出现了这个问题,找到 \node_modules.2.5.0@vue-echarts\node_modules\echarts下的lib\目录,用旧版本的lib\替换掉

I had the same problem, I fixed it by changing my import from:

import echarts from 'echarts';

to:

import { init } from 'echarts';

Also in my webpack config DefinePlugin section I had to set:

__DEV__: true,

(and false for prod build)

same problem for me, I didn't use vue-echarts, i just use echarts as is and the console gives warning:
"export 'default' (imported as 'echarts') was not found in 'echarts'

"export 'default' (imported as 'echarts') was not found in 'echarts' +10086

最新版的echarts中的echarts/lib/echarts.js里没有module.export 也没有export default
所以require(‘echarts’)报错
import echarts from 'echarts'也报错
可能跟版本有关

the same issuse

me too

临时解决方案:

  1. 引入echarts的地方改为
import * as echarts from 'echarts'
  1. webpack的DefinePlugin里加入如下字段
// 此处根据情况自行修改,结果为boolean就行,true的情况下会多一些日志信息
'__DEV__': process.env.node_env === 'dev' 

或者
npm un echarts && npm i -E [email protected] [email protected]

比较尴尬

$ cat node_modules/echarts/package.json| grep version
  "version": "3.7.2",

$ cat node_modules/vue-echarts/node_modules/echarts/package.json | grep version
  "version": "3.8.0",

我写死了使用 [email protected] 但是 vue-echarts 写的是 "echarts": "^3.7.2",

cnpm i [email protected] [email protected]

# zrender
cd node_modules/echarts/node_module
ln -snf ../../[email protected]@zrender ./zrender

我们在新发布的 3.8.2 中将 lib 下的重新转译成了 CommonJS 格式,应该解决了大家构建的兼容问题。非常抱歉新版本的模块系统给大家造成了这么大的麻烦。

辛苦了。我现在更新到3.8.2能解决type:line时报undefined的错误么。。

@zsychy 把错误和代码贴出来看下?

mounted(){
......
series:[
   {type:'line}
]
}

上面是代码

Error in mounted hook: "TypeError: Cannot read property 'get' of undefined"

上面是报错,

把代码中的type:line换成pie就都可以了,换成bar也会报错。。是我引用的有问题么。但是pie和其他的引用方法是一样的都是import

有完整的配置项?可能这个问题跟这次的模块没有关系

嗷没事了。老铁。。是我自己虎。。。有些配置要置空。。我没有写上去,
@pissang 非常感谢大佬指点

请问你的问题是怎么解决的,我这边也遇到了 @zsychy

Was this page helpful?
0 / 5 - 0 ratings