apexcharts / ng-apexcharts

ng-apexcharts is an implementation of apexcharts for angular. It comes with one simple component that enables you to use apexcharts in an angular project.
MIT License
318 stars 80 forks source link

Can't import the named export x from non EcmaScript module #190

Closed Nurech closed 1 month ago

Nurech commented 2 years ago

Errors

Error: ./node_modules/ng-apexcharts/fesm2015/ng-apexcharts.mjs 321:10-19
Can't import the named export 'Component' from non EcmaScript module (only default export is available)

Error: ./node_modules/ng-apexcharts/fesm2015/ng-apexcharts.mjs 330:12-17
Can't import the named export 'Input' from non EcmaScript module (only default export is available)

Error: ./node_modules/ng-apexcharts/fesm2015/ng-apexcharts.mjs 333:12-17
Can't import the named export 'Input' from non EcmaScript module (only default export is available)

//...

I have tried adding this to compilerOptions.

    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,

I have tried configuring webpack

module.exports = {
  configureWebpack: {
    module: {
      rules: [
        {
          test: /\.mjs$/,
          include: /node_modules/,
          type: "javascript/auto"
        }
      ]
    }
  }
}

package.json

{
  "name": "xxx",
  "version": "0.1.00",
  "scripts": {
    "ng": "ng",
    "start": "npm install && ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "protractor": "protractor e2e/protractor.conf.js"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~11.2.14",
    "@angular/cdk": "^11.2.13",
    "@angular/common": "~11.2.14",
    "@angular/compiler": "~11.2.14",
    "@angular/core": "~11.2.14",
    "@angular/forms": "~11.2.14",
    "@angular/localize": "^11.2.14",
    "@angular/material": "^11.2.13",
    "@angular/material-moment-adapter": "^12.2.1",
    "@angular/platform-browser": "~11.2.14",
    "@angular/platform-browser-dynamic": "~11.2.14",
    "@angular/router": "~11.2.14",
    "@angular/service-worker": "~11.2.14",
    "@ng-bootstrap/ng-bootstrap": "^10.0.0",
    "@ng-idle/core": "^10.0.0-beta.1",
    "@ngneat/until-destroy": "^8.1.4",
    "@ngx-translate/core": "^13.0.0",
    "@ngx-translate/http-loader": "^6.0.0",
    "@popperjs/core": "^2.9.2",
    "@swimlane/ngx-charts": "^19.1.0",
    "apexcharts": "^3.33.1",
    "bootstrap": "^5.0.1",
    "deepmerge": "^4.2.2",
    "humanize-duration": "^3.27.0",
    "leader-line-new": "^1.1.9",
    "moment": "^2.29.1",
    "ng-apexcharts": "^1.7.0",
    "ng-circle-progress": "^1.6.0",
    "ng-click-outside": "^7.0.0",
    "ng2-tooltip-directive": "~2.9.22",
    "ngx-drag-scroll": "^12.0.0-beta.1",
    "ngx-humanize-duration": "^1.2.5",
    "ngx-infinite-scroll": "^10.0.1",
    "ngx-material-timepicker": "^5.5.3",
    "ngx-spinner": "^11.0.0",
    "rxjs": "^6.6.7",
    "tslib": "^2.0.0",
    "uuid": "^8.3.2",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.1102.14",
    "@angular-eslint/builder": "4.3.0",
    "@angular-eslint/eslint-plugin": "4.3.0",
    "@angular-eslint/eslint-plugin-template": "4.3.0",
    "@angular-eslint/schematics": "4.3.0",
    "@angular-eslint/template-parser": "4.3.0",
    "@angular/cli": "~11.2.14",
    "@angular/compiler-cli": "~11.2.14",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "4.16.1",
    "@typescript-eslint/parser": "4.16.1",
    "eslint": "^7.6.0",
    "jasmine-core": "~3.8.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.3.4",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "typescript": "~4.0.8"
  }
}

✅ This works package.json:

    "apexcharts": "3.33.0",
    "ng-apexcharts": "1.6.0",
mouazAlkhodari commented 2 years ago

i think this issue happened in last version since 1.7.0

subash01 commented 2 years ago

Is your issue gets solved @Nurech, I am too facing this issue

DariaCohen commented 2 years ago

Hello, is there a solution for this problem?

tarastmb commented 2 years ago

To temporary solve it, in package.json downgrade the version of ng-apexcharts to 1.6.0 You can keep latest the version of apexcharts (3.35.2)

...
"apexcharts": "3.35.2",
"ng-apexcharts": "1.6.0",
...

then run npm install

junedchhipa commented 2 years ago

@damingerdai This happened after we upgraded to angular 13.

damingerdai commented 2 years ago

angular 13 has a lot of break change, so please update newest angular version with ng-apexcharts 1.7.0

scavenius commented 2 years ago

I have the same issue, if somebody have a solution please!

Mufaddal007 commented 11 months ago

I am also facing same issue, if anyone has any solutions, kindly post. Unable to use mat-select-search in angular 15.

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.