I was hoping to use replit.com to draft out a behaviour on a JSON file, but the import of a JSON doesn’t appear to work (although the same approach normally works in a Typescript project with the proper config). Is this a limitation of replit ?
Here’s a screenshot showing the project structure, the code and the error.
In the end I switched to using tsc fully, rather than esbuild, which then respects the target files and copies them to the destination.
It needed outDir to be set to .build and noEmit:falseresolveJsonModules:true and esModuleInterop:true in compilerOptions of my tsconfig.json.
After that, the following config.sh (after removing all the Entrypoints and esbuild stuff) fulfilled my requirements as well as showing compiler errors in the shell and hopefully accelerating subsequent builds (--build should put metadata in the outDir)…
rm -rf .build
mkdir -p ./.build
npm run env -- tsc --build