Skip to content

Commit

Permalink
chore: make node.js can run out code
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Sep 14, 2023
1 parent c5968f5 commit e2fbf69
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 10 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules
lib
dist
build
.DS_Store
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
```bash
pnpm i
pnpm build
pnpm execute
```
4 changes: 2 additions & 2 deletions esm/a.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { B } from "./b";
import { C } from "./c";
import { B } from "./b.js";
import { C } from "./c.js";
console.log("Hello", B, C);
2 changes: 1 addition & 1 deletion esm/b.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { sleep } from "./d";
import { sleep } from "./d.js";
await sleep(1000);
export const B = 'TLA (b)';
2 changes: 1 addition & 1 deletion esm/c.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { sleep } from "./d";
import { sleep } from "./d.js";
await sleep(500);
export const C = 'TLA (c)';
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"build": "tsc",
"execute": "node esm/a.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
Expand Down
4 changes: 2 additions & 2 deletions src/a.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { B } from "./b";
import { C } from "./c";
import { B } from "./b.js";
import { C } from "./c.js";

console.log("Hello", B, C);
2 changes: 1 addition & 1 deletion src/b.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sleep } from "./d";
import { sleep } from "./d.js";

await sleep(1000);
export const B = 'TLA (b)';
2 changes: 1 addition & 1 deletion src/c.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sleep } from "./d";
import { sleep } from "./d.js";

await sleep(500);
export const C = 'TLA (c)';
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "ES2017",
"module": "esnext",
"module": "NodeNext",
"outDir": "./esm"
},
"include": [
Expand Down

0 comments on commit e2fbf69

Please sign in to comment.