fx-code-start
v0.1.0
Published
TypeScript runtime hot patch starter using swc-node
Readme
fx-code-start
TypeScript runtime starter that patches static imports on the fly and compiles with swc-node for fast startup.
Installation
npm install -g fx-code-start
# or local dev
npm installUsage
Basic run:
npx fx-code-start path/to/index.ts [app-args]Multi-file patch:
npx fx-code-start index.ts --patch server/components/index.ts --patch lib/a.tsThe
--patchflag accepts multiple occurrences or a list of files. All patched files are converted to CommonJSrequirebefore compilation.Debug with VS Code / Chrome:
npx fx-code-start index.ts --inspectStart from VS Code Debug Terminal so breakpoints bind to the inlined source maps generated by swc-node.
All unknown CLI options are forwarded to your target script.
Advanced
- Environment variable
FX_PATCH_FILEScan be set to a comma-separated list of absolute or relative paths. These paths are normalized and matched against loaded.tsfiles. When not set,server/components/index.tsis patched by default. - The loader hooks into
require.extensions['.ts']to intercept matches, transform imports torequire, compile with@swc-node/coreusing inline source maps, and execute the result.
