2

I can't get Chance js to work in my vue project. I install and import it locally and it give this error when I try to access chance.paragraph() in the .vue file.

__WEBPACK_IMPORTED_MODULE_0_chance___default.a.paragraph is not a function"

Running chance.paragraph() in the console does work though

snoob dogg
  • 2,491
  • 3
  • 31
  • 54

1 Answers1

4

How did you include it? sourcecode seems to give the answer:

enter image description here

Edit: i thought you can use it directly but the website says otherwise using nodejes:

// Load Chance
var Chance = require('chance');

// Instantiate Chance so it can be used
var chance = new Chance();

// Use Chance here.
var paragraph = chance.paragraph();
Joel Harkes
  • 10,975
  • 3
  • 46
  • 65