Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

206
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!