Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

311
Visualizações
Uncaught TypeError: root is undefined papaparse

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

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The problem was that papaparse didn't like the import as. I have added the URL into the script in the HTML page connected to the JS page and now works fine.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda