Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eCharts import does not work. Fails with _DEV__ is not defined

I installed using NPM, echarts library in this way

npm install echarts --save

Following the documentation I wrote in my code

import * as echarts from 'echarts'

then I tried a very simple example

const $chart = $('#chart')
let myChart = echarts.init($chart)
const option = {
  title: {
    text: 'ECharts entry example'
  },
  tooltip: {},
  legend: {
    data: ['Sales']
  },
  xAxis: {
    data: ['shirt', 'cardign', 'chiffon shirt', 'pants', 'heels', 'socks']
  },
  yAxis: {},
  series: [
    {
      name: 'Sales',
      type: 'bar',
      data: [5, 20, 36, 10, 10, 20]
    }
  ]
}
myChart.setOption(option)

but I got this error

ReferenceError: __DEV__ is not defined

What do you think is the problem? I can't find documentation about this error...

like image 537
michoprogrammer Avatar asked Dec 06 '25 07:12

michoprogrammer


1 Answers

This worked for me (echarts 4.2.1): import * as echarts from 'echarts';

like image 175
gamliela Avatar answered Dec 07 '25 19:12

gamliela



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!