I have a problem with papaparse
in my code, I try to parse a string but is giving me this error:
Uncaught TypeError: root is undefined"
the code is like:
import * as Papa from "../file/papaparse/papaparse.js";
input.onchange = e => {
var file = e.target.files[0];
var reader = new FileReader();
reader.readAsText(file, 'UTF-8');
reader.onload = readerEvent => {
let imported = readerEvent.target.result;
let splittedimp = this.$Papa.parse(imported, {
"header": true
})
console.log(splittedimp);
}
}
the input.onchange
is inside an async function.
any idea why this error?
The error happen in papaparse file, line 25:
root.Papa = factory();
also i didn't use nodejs or jquery, i have simply downloaded the file and imported it into a folder in my project