Skip to content
Advertisement

Electron+nuxt+amCharts 4: Unexpected token export

I want to code a desktop application using Electron, nuxt.js and am4charts. When importing the am4charts core with

import * as am4core from '@amcharts/amcharts4/core'

the app returns an error:

JavaScript

My setup:

I already tried to transpile amCharts in nuxt.config.js using

JavaScript

but without success. How can I fix this issue?

Advertisement

Answer

I found it could be known issue between nuxt.js and amcharts.js and it has a solution as follows:

create a file plugins/amcharts.js

JavaScript

then add to nuxt.config.js

JavaScript

in components file

JavaScript

Solution is found on Github: https://github.com/nuxt/nuxt.js/issues/3336

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement