@gadmin2n/schematics 0.0.131 → 0.0.133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/application/files/gadmin2-game-angle-demo/server/src/lib/taihu.ts +1 -1
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/ecosystem.dev.config.cjs +3 -1
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/package.json +1 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/vite.config.ts +12 -4
- package/package.json +1 -1
|
@@ -13,7 +13,9 @@ module.exports = {
|
|
|
13
13
|
// NODE_OPTIONS 保留原 package.json 里的 4GB 上限设置。
|
|
14
14
|
node_args: '--max-old-space-size=4096',
|
|
15
15
|
env: {
|
|
16
|
-
...(process.env.VITE_BRANCH_OWNER
|
|
16
|
+
...(process.env.VITE_BRANCH_OWNER
|
|
17
|
+
? { VITE_BRANCH_OWNER: process.env.VITE_BRANCH_OWNER }
|
|
18
|
+
: {}),
|
|
17
19
|
},
|
|
18
20
|
},
|
|
19
21
|
],
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"dev": "NODE_OPTIONS='--max-old-space-size=4096' vite --port 3000",
|
|
82
82
|
"build": "tsc && vite build",
|
|
83
83
|
"preview": "vite preview",
|
|
84
|
+
"typecheck": "tsc --noEmit",
|
|
84
85
|
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx}\"",
|
|
85
86
|
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
86
87
|
"prepare": "cd .. && husky install || true"
|
|
@@ -5,8 +5,15 @@ import tsconfigPaths from 'vite-tsconfig-paths';
|
|
|
5
5
|
import { devShellPlugin } from './src/plugins/devShellPlugin';
|
|
6
6
|
|
|
7
7
|
// gadmin g prisma 生成完毕后触发:CLI 会 touch 本文件,
|
|
8
|
-
//
|
|
9
|
-
//
|
|
8
|
+
// 插件监听变更后 invalidate module graph 并广播 full-reload。
|
|
9
|
+
//
|
|
10
|
+
// 历史:曾用 server.restart(),每次会重新 esbuild bundle 一次 vite.config.ts
|
|
11
|
+
// 及其依赖,旧 config module 被 v8 保留,实测每次泄漏 15~20MB rss,
|
|
12
|
+
// 几十次调用后进程内存从 60MB 涨到 600MB+。
|
|
13
|
+
//
|
|
14
|
+
// 改用 moduleGraph.invalidateAll() + hot full-reload:
|
|
15
|
+
// - invalidateAll() 只清 transform 结果,不重载 config、不重跑 esbuild
|
|
16
|
+
// - full-reload 让浏览器重新请求,vite 按最新文件重新 transform
|
|
10
17
|
function gadminRestartPlugin(): Plugin {
|
|
11
18
|
const sentinel = path.resolve(__dirname, '.vite-restart');
|
|
12
19
|
return {
|
|
@@ -16,10 +23,11 @@ function gadminRestartPlugin(): Plugin {
|
|
|
16
23
|
server.watcher.on('change', (file) => {
|
|
17
24
|
if (path.resolve(file) === sentinel) {
|
|
18
25
|
server.config.logger.info(
|
|
19
|
-
'[gadmin] generated code changed,
|
|
26
|
+
'[gadmin] generated code changed, invalidating & full-reload...',
|
|
20
27
|
{ timestamp: true },
|
|
21
28
|
);
|
|
22
|
-
server.
|
|
29
|
+
server.moduleGraph.invalidateAll();
|
|
30
|
+
server.hot.send({ type: 'full-reload', path: '*' });
|
|
23
31
|
}
|
|
24
32
|
});
|
|
25
33
|
},
|