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
}
}