Skip to content

Commit

Permalink
Do not use import2() more for webpack build.
Browse files Browse the repository at this point in the history
When building webpack of node application without node_modules, `import2()` statements be a great obstable for that.

Therefore, stopped using it for such special bundling.
  • Loading branch information
samchon committed Nov 21, 2023
1 parent ce72c13 commit 0ffb806
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"email": "[email protected]",
"url": "https://github.com/samchon"
},
"version": "0.8.8",
"version": "0.8.9",
"main": "index.js",
"typings": "index.d.ts",
"scripts": {
Expand All @@ -26,7 +26,6 @@
"test:node": "node dist/test/node"
},
"dependencies": {
"import2": "^1.0.0",
"serialize-error": "^4.1.0",
"tstl": "^2.5.13",
"uuid": "^9.0.0",
Expand Down
15 changes: 7 additions & 8 deletions src/utils/internal/NodeModule.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import include from "import2";
import type * as __cp from "child_process";
import type * as __fs from "fs";
import type * as __http from "http";
Expand All @@ -11,24 +10,24 @@ import { Singleton } from "tstl/thread/Singleton";

export namespace NodeModule {
export const cp: Singleton<Promise<typeof __cp>> = new Singleton(() =>
include("child_process"),
import("child_process"),
);
export const fs: Singleton<Promise<typeof __fs>> = new Singleton(() =>
include("fs"),
import("fs"),
);
export const http: Singleton<Promise<typeof __http>> = new Singleton(() =>
include("http"),
import("http"),
);
export const https: Singleton<Promise<typeof __https>> = new Singleton(() =>
include("https"),
import("https"),
);
export const os: Singleton<Promise<typeof __os>> = new Singleton(() =>
include("os"),
import("os"),
);
export const thread: Singleton<Promise<typeof __thread>> = new Singleton(
() => include("worker_threads"),
() => import("worker_threads"),
);
export const ws: Singleton<Promise<typeof __ws>> = new Singleton(() =>
include("ws"),
import("ws"),
);
}

0 comments on commit 0ffb806

Please sign in to comment.