when using amcharts4 in webpack - module has no exports error

Viewed 13

I am using the webpack and installed amchart with

yarn add @amcharts/amcharts4

my package.json is like this below

{
  "name": "frontend",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "build": "webpack --mode=production",
    "dev": "webpack-dev-server --mode=development"
  },
  "dependencies": {
    "@amcharts/amcharts4": "^4.10.28",
    "copy-webpack-plugin": "^11.0.0",
    "css-loader": "^6.7.1",
    "file-loader": "^6.2.0",
    "jquery": "^3.6.1",
    "jquery-easing": "^0.0.1",
    "mini-css-extract-plugin": "^2.6.1",
    "rimraf": "^3.0.2",
    "sass": "^1.54.9",
    "sass-loader": "^13.0.2",
    "slick-carousel": "^1.8.1",
    "slickgrid-es6": "^3.0.3",
    "style-loader": "^3.3.1",
    "stylelint-webpack-plugin": "^3.3.0",
    "webpack": "^5.74.0",
    "webpack-bundle-tracker": "^1.6.0",
    "webpack-cli": "^4.10.0",
    "webpack-dev-server": "^4.11.1",
    "webpack-merge": "^5.8.0"
  }
}

Then I have this code in my script

    import * as am4charts from "@amcharts/amcharts4/charts";

    this.valueAxis2 = this.chart.yAxes.push(new am4charts.ValueAxis());

However it shows this error.

WARNING in ./static/entries/BalanceChart.js 16:52-71
export 'ValueAxis' (imported as 'am4charts') was not found in '@amcharts/amcharts4/charts' (module has no exports)

I guess there is something wrong with importing amchart library.

What does module has no exports mean in this case?

0 Answers
Related