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

Angular build error

manittrivedi opened this issue · 3 comments

Here are my project specifications:

Angular version: 6.1.0
Node version: 8.11.3
NPM version: 5.6.0
chartjs version: 2.7.2
chartjs-chart-box-and-violin-plot version: 1.4.1

The scripts array in angular.json file:

"scripts": [
              "node_modules/chart.js/dist/Chart.js",
              "node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.min.js",
              "node_modules/hammerjs/hammer.min.js"
            ]

I have also imported in the main module of the project:
import 'chartjs-chart-box-and-violin-plot';

Take a look at the error I see in my Angular build logs:

ERROR in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs
1016:0-8 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
1016:19-26 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
1016:38-46 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
1017:0-8 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
1017:29-36 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
1017:48-56 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
1020:19-27 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
1029:4-15 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
1062:14-25 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
1062:36-47 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
1063:24-35 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
1063:56-67 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
1066:0-8 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
1066:18-25 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
1066:37-45 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
1067:0-8 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
1067:28-35 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
1067:47-55 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
1070:19-27 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
1079:4-15 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
1139:15-26 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
1139:36-47 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
1140:23-34 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
1140:54-65 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
1142:16-23 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
1143:71-83 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
1144:23-35 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
1146:11-26 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
1154:0-12 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
1156:16-23 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
1157:76-88 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
1158:28-40 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
1160:11-26 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
1189:0-12 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
436:35-43 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
439:16-24 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
443:23-31 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
444:19-27 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
447:23-30 Can't import the named export 'Element' from non EcmaScript module (only default export is available)

ERROR in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs
467:8-21 Can't import the named export 'canvasHelpers' from non EcmaScript module (only default export is available)

ERROR in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs
471:8-21 Can't import the named export 'canvasHelpers' from non EcmaScript module (only default export is available)

ERROR in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs
571:0-8 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
601:20-28 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
603:12-19 Can't import the named export 'Element' from non EcmaScript module (only default export is available)

ERROR in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs
618:21-28 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
790:0-8 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
823:13-21 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
825:12-19 Can't import the named export 'Element' from non EcmaScript module (only default export is available)

ERROR in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs
840:20-27 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
859:4-17 Can't import the named export 'canvasHelpers' from non EcmaScript module (only default export is available)

ERROR in ./node_modules/chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.mjs
978:4-15 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
980:70-77 Can't import the named export 'helpers' from non EcmaScript module (only default export is available)

i 「wdm」: Failed to compile.

Hi @manittrivedi,
sorry for the late notice as I have been quite busy the last days.

Here is an example project with similar requirements to yours: https://github.com/sluger/ng-chartjs-boxplot

The incomaptibility with Webpack 4, mjs and Angular CLI can be solved by importing the chartjs boxplot library via the .js build artifact:

import "chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.js";

I hope that helps.

Stefan

Thanks, this solved it. Had the same problem. Maybe a hint in the readme would be a good idea to help others find the solution.

Thanks, this solved it. Had the same problem. Maybe a hint in the readme would be a good idea to help others find the solution.

Good idea, I have updated the readme for the develop branch.