Kazi
Kazi

Reputation: 1553

Can't import the named export 'ɵɵngDeclareFactory' from non EcmaScript module in my angular 11 app

In my angular 11 apps, I am trying to install ngx-echats. Unfortunately, I am getting an error when exporting NgxEchartsModule in my app.module.ts.

That is the error that I am getting:

Error: ./node_modules/ngx-echarts/fesm2015/ngx-echarts.mjs 520:24-45
Can't import the named export 'ɵɵngDeclareFactory' from non EcmaScript module (only default export is available)

In my app root folder, I already have an webpack.config.js file and it includes with :

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

Still, I am having this error. Can someone please tell me how to solve this issue?

Upvotes: 3

Views: 20609

Answers (3)

Vedran
Vedran

Reputation: 11039

If you check the ngx-graph commit history, version 8 is already for Angular 12 - you have to use the 8.0.0-rc.1 for it to work with Angular 11.

Upvotes: 0

Kazi
Kazi

Reputation: 1553

I was using the latest version of ngx-echarts, version 8, which was not compatible with angular 11. Downgraded to ngx-echats, version 6 solved the issue. Thank you all.

Upvotes: 6

Haris Bouchlis
Haris Bouchlis

Reputation: 2566

You must update the angular cli to the latest version

Upvotes: 2

Related Questions