I would like a setup for my project with the following configurations.
import foo from 'bar'
.module.exports = ...
export default { foo: ... }
Many of these features works out of the box with frameworks like next.js
, vite.js
, cra
. However these all have alot of additional functionaliy and restrictions i do not want. For example a dev server which I do not need, and restrictions to where the src
folder must be.
In short, I just want to execute self written typescript ESM files, using all sorts of 3rd party imports.
What is the best approach? Find and existing framework, like ts-node? Or setup something from scratch?
Any input on how to set this up, or which frameworks to check out is much appreciated.
What I am currently trying is ts-node, but i can't get ESM imports to work. I get a message saying i should set ´type´ to module
in my package.json. But in my experiance this will prohibit loading of 3rd party code using CommonJS export.
Is it possible to set a specific loader for ts-node?
tsx
runner - https://github.com/esbuild-kit/tsx.tsx foo.ts
to run, tsx --inspect watch foo.ts
to start watcher with enabled inspectornoEmit
and esModuleInterop
in tsconfig to avoid any outputs and allow importing cjs"type": "module"
and "main": "src /index.ts"
to run tsx .