[v5] export 'default' (imported as 'echarts') was not found in 'echarts'
See original GitHub issueVersion
v5
Steps to reproduce
<template>
<div id="main" style="width: 600px; height: 400px"></div>
</template>
<script>
import echarts from 'echarts'
export default {
mounted() {
// based on prepared DOM, initialize echarts instance
const myChart = echarts.init(document.getElementById('main'))
// specify chart configuration item and data
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],
},
],
}
// use configuration item and data specified to show chart
myChart.setOption(option)
},
}
</script>
<style lang="scss" scoped></style>
What is expected?
Works out of the box
What is actually happening?
Not working
Works in v4 though, how to import echarts ESM in v5?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
echarts安装后报错“export 'default' (imported as ... - CSDN博客
echarts 安装后报错“export 'default' (imported as 'echarts') was not found in 'echarts' · 2.解决办法一 · 解决办法二.
Read more >Migration from v4 to v5 - What's New - Basics - Apache ECharts
Importing ECharts. Removing Support for Default Exports. Since v5 , echarts only provides named exports . So if you are importing echarts like...
Read more >Echarts报“export 'default' (imported as 'echarts') was ... - 博客园
一、问题分析找不到导入的Echarts,原因是因为echarts for react不支持5.0版本以上的echarts 二、解决方案1.查看自己echarts的版本在文件package.jso.
Read more >Echarts报“export 'default' (imported as 'echarts ... - CodeAntenna
Vue的main.js中引入echarts后报"export'default'(importedas'echarts')wasnotfoundin'echarts'解决办法:1、5.0以下的版本跟5.0以上的版本引入方法不一样5.0以上可以通过: ...
Read more >Import ECharts - Basics - The Apache Software Foundation!
There are two approaches to using ECharts as a package. The simplest approach is to make all functionality immediately available by importing from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
import echarts from 'echarts'
is not a recommanded usage for es modules and is deprecated in 5.0Use
import * as echarts from 'echarts'
instead@wenfangdu Maybe this article can give you an answer.