datavisyn/chartjs-chart-box-and-violin-plot

Import error

ferndot opened this issue · 5 comments

I am trying to use this in my Vue.js project with vue-chartjs. Sadly, I receive this error:

Expand to see the error

 ERROR  Failed to compile with 52 errors                                                 1:06:34 PM

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'Element' from non EcmaScript module (only default export is availabl
e)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'Element' from non EcmaScript module (only default export is availabl
e)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'Element' from non EcmaScript module (only default export is availabl
e)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'LinearScaleBase' from non EcmaScript module (only default export is 
available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'LinearScaleBase' from non EcmaScript module (only default export is 
available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'canvasHelpers' from non EcmaScript module (only default export is av
ailable)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'canvasHelpers' from non EcmaScript module (only default export is av
ailable)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'canvasHelpers' from non EcmaScript module (only default export is av
ailable)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'controllers' from non EcmaScript module (only default export is avai
lable)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'controllers' from non EcmaScript module (only default export is avai
lable)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'controllers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'controllers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'controllers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'controllers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'controllers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'controllers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'controllers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'controllers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'controllers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'defaults' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'defaults' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'defaults' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'defaults' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'defaults' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'defaults' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'defaults' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'defaults' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'defaults' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'defaults' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'defaults' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'defaults' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'defaults' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'defaults' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'elements' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'elements' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'elements' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'elements' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'helpers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'helpers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'helpers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'helpers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'helpers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'helpers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'helpers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'helpers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'helpers' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'scaleService' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'scaleService' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'scaleService' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'scaleService' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'scaleService' from non EcmaScript module (only default export is available)

 error  in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs

Can't import the named export 'scaleService' from non EcmaScript module (only default export is available)


Here is my chart component:

import 'chartjs-chart-box-and-violin-plot'
import { generateChart } from 'vue-chartjs'

export default generateChart('boxplot', 'boxplot')

Do you have any ideas about how to resolve this?

why type of bundler are you using? webpack, rollup, ...?

I am using Webpack 4

this simple setup worked for me: https://codesandbox.io/s/vy8r1x5ow5

That is odd: it works for me if I delete the node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs file.

It is looking like maybe this is an issue with my webpack config since it is working for your simple setup

I fixed this by adding the following to my webpack config:

module: {
  rules: [
    {
      test: /\.mjs$/,
      include: /node_modules/,
      type: 'javascript/auto'
    }
  ]
}