r/javaScriptStudyGroup • u/CCmamo • Feb 23 '22
const { Classifier } = require('ml-classify-text') or import Classifier from 'ml-classify-text' ?
I am trying to use the mlclassify text library with javascript:
https://github.com/andreekeberg/ml-classify-text-js
in the docs, its says that i need to use:
const { Classifier } = require('ml-classify-text') or
import Classifier from 'ml-classify-text' to import it.
neither is working for me
if i use require, it gives me:
script.js:1 Uncaught ReferenceError: require is not defined at and if i use import, it gives me:
Uncaught SyntaxError: Cannot use import statement outside a module I dont seem to find a working get-around for either
Thanks if you can help!
1
Upvotes