Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

208
Vistas
Using require in TypeScript in order to load modules in the browser

I have a web page on which I would like to use a TypeScript file I created. That web page uses a few modules, most importantly vega-lite, papaparse, and tabulator-tables. I would like to load them into the code via TypeScript, and when I attempt to write into the TS file a line such as the following:

const Papa = require("papaparse");

I don't get any errors on compiling, but when I load the HTML page I get a require is not defined error. I suspect it has something to do with my tsconfig.json, so I'm attaching it. Does anyone know how to solve this? The structure of my project is:

node_modules
public
    index.html
    styles.css
    index.js
src
    index.ts

And this is my tsconfig.json file:

{   
  "compilerOptions":
  {
    "target": "es2021",
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "outDir": "./public",
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "noImplicitAny": false,
    "strictNullChecks": false,
    "skipLibCheck": true
  }
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda