Skip to content

Commit

Permalink
chore: use register hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed May 15, 2024
1 parent 1a96d62 commit 1d28202
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/inertia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"lint": "eslint .",
"typecheck": "tsc --noEmit",
"build": "tsup-node",
"test": "c8 node --enable-source-maps --loader ts-node/esm bin/test.ts",
"quick:test": "node --enable-source-maps --loader ts-node/esm bin/test.ts",
"test": "c8 npm run quick:test",
"quick:test": "node --import=./tsnode.esm.js --enable-source-maps bin/test.ts",
"checks": "pnpm lint && pnpm typecheck"
},
"peerDependencies": {
Expand Down
19 changes: 19 additions & 0 deletions packages/inertia/tsnode.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
|--------------------------------------------------------------------------
| TS-Node ESM hook
|--------------------------------------------------------------------------
|
| Importing this file before any other file will allow you to run TypeScript
| code directly using TS-Node + SWC. For example
|
| node --import="./tsnode.esm.js" bin/test.ts
| node --import="./tsnode.esm.js" index.ts
|
|
| Why not use "--loader=ts-node/esm"?
| Because, loaders have been deprecated.
*/

import { register } from 'node:module'

register('ts-node/esm', import.meta.url)

0 comments on commit 1d28202

Please sign in to comment.