Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue-chartjs not working with lodash-webpack-plugin installed #97

Closed
arunrreddy opened this issue Apr 29, 2017 · 2 comments
Closed

vue-chartjs not working with lodash-webpack-plugin installed #97

arunrreddy opened this issue Apr 29, 2017 · 2 comments

Comments

@arunrreddy
Copy link

Expected Behavior

Vue-chartjs should rendered chart

Actual Behavior

Vue-chartjs throws an error: cannot find length of undefined referring to partial variable.
I am using the 'lodash-webpack-plugin' in my application and this is my config for the plugin.
{ coercions: true, paths: true, guards: true, unicode: true, collections: true, shorthands: true }

I have tried clone this repo and the adding this plugin and running the tests. Ten of the twenty-six tests fail.
Here are the errors which resulted after running the tests with the webpack-plugin included:
mergeOptions.js
✗ should replace old a and b if a and b are new
undefined is not an object (evaluating 'partials.length')
wrapper@webpack:///~/lodash/_createWrap.js:28:0 <- index.js:35529:31
mergeOptions@webpack:///src/helpers/options.js:9:761 <- index.js:34445:786
webpack:///test/unit/specs/helpers/options.spec.js:19:26 <- index.js:38559:41

✗ should add c if c is new
undefined is not an object (evaluating 'partials.length')
wrapper@webpack:///~/lodash/_createWrap.js:28:0 <- index.js:35529:31
mergeOptions@webpack:///src/helpers/options.js:9:761 <- index.js:34445:786
webpack:///test/unit/specs/helpers/options.spec.js:25:26 <- index.js:38565:41

PhantomJS 2.1.1 (Linux 0.0.0): Executed 26 of 26 (10 FAILED) (0.158 secs / 0.037 secs)
TOTAL: 10 FAILED, 16 SUCCESS

  1. should destroy chart instance
    BarChart
    undefined is not an object (evaluating 'vm.$children[0]._chart.chart')
    webpack:///test/unit/specs/Bar.spec.js:54:34 <- index.js:209:35

  2. should destroy chart instance
    BubbleChart
    undefined is not an object (evaluating 'vm.$children[0]._chart.chart')
    webpack:///test/unit/specs/Bubble.spec.js:54:34 <- index.js:37883:35

  3. should destroy chart instance
    DoughnutChart
    undefined is not an object (evaluating 'vm.$children[0]._chart.chart')
    webpack:///test/unit/specs/Doughnut.spec.js:54:34 <- index.js:37985:35

  4. should destroy chart instance
    HorizontalBarChart
    undefined is not an object (evaluating 'vm.$children[0]._chart.chart')
    webpack:///test/unit/specs/HorizontalBar.spec.js:54:34 <- index.js:38087:35

  5. should destroy chart instance
    LineChart
    undefined is not an object (evaluating 'vm.$children[0]._chart.chart')
    webpack:///test/unit/specs/Line.spec.js:54:34 <- index.js:38189:35

  6. should destroy chart instance
    PieChart
    undefined is not an object (evaluating 'vm.$children[0]._chart.chart')
    webpack:///test/unit/specs/Pie.spec.js:53:34 <- index.js:38290:35

  7. should destroy chart instance
    PolarChart
    undefined is not an object (evaluating 'vm.$children[0]._chart.chart')
    webpack:///test/unit/specs/PolarArea.spec.js:54:34 <- index.js:38392:35

  8. should destroy chart instance
    RadarChart
    undefined is not an object (evaluating 'vm.$children[0]._chart.chart')
    webpack:///test/unit/specs/Radar.spec.js:53:34 <- index.js:38493:35

  9. should replace old a and b if a and b are new
    mergeOptions.js
    undefined is not an object (evaluating 'partials.length')
    wrapper@webpack:///~/lodash/_createWrap.js:28:0 <- index.js:35529:31
    mergeOptions@webpack:///src/helpers/options.js:9:761 <- index.js:34445:786
    webpack:///test/unit/specs/helpers/options.spec.js:19:26 <- index.js:38559:41

  10. should add c if c is new
    mergeOptions.js
    undefined is not an object (evaluating 'partials.length')
    wrapper@webpack:///~/lodash/_createWrap.js:28:0 <- index.js:35529:31
    mergeOptions@webpack:///src/helpers/options.js:9:761 <- index.js:34445:786
    webpack:///test/unit/specs/helpers/options.spec.js:25:26 <- index.js:38565:41

Environment

  • vue.js version: 2.2.6
  • vue-chart.js version: 2.5.0
  • npm version: >=6.9.0
@apertureless
Copy link
Owner

Hey @arunrreddy

mh, I never used the lodash-webpack-plugin but as I understand it will remove functions form lodash right?

Well, the mergeOptions helper is importing merge from lodash: import merge from 'lodash/fp/merge'

It seems that the webpack-plugin is removing merge? Not sure in which feature set this might fall, maybe clone. You could try to enable the cloning methods in your config.

@arunrreddy
Copy link
Author

arunrreddy commented Apr 30, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants