Search
Esmx 是一个现代化的 SSR 框架,采用标准化的项目结构和路径解析机制,以确保项目在开发和生产环境中的一致性和可维护性。
root │─ dist # 编译输出目录 │ ├─ package.json # 编译输出后的软件包配置 │ ├─ server # 服务端编译输出 │ │ └─ manifest.json # 编译清单输出,用于生成 importmap │ ├─ node # Node 服务器程序编译输出 │ ├─ client # 客户端编译输出 │ │ ├─ versions # 版本存储目录 │ │ │ └─ latest.tgz # 将 dist 目录归档,对外提供软件包分发 │ │ └─ manifest.json # 编译清单输出,用于生成 importmap │ └─ src # 使用 tsc 生成的文件类型 ├─ src │ ├─ entry.server.ts # 服务端应用程序入口 │ ├─ entry.client.ts # 客户端应用程序入口 │ └─ entry.node.ts # Node 服务器应用程序入口 ├─ tsconfig.json # TypeScript 配置 └─ package.json # 软件包配置
esmx.name
package.json
name
dist/package.json
packs.enable
true
dist
客户端入口文件负责:
服务端入口文件负责:
Node.js 服务器入口文件负责:
{ "name": "your-app-name", "type": "module", "scripts": { "dev": "esmx dev", "build": "npm run build:dts && npm run build:ssr", "build:ssr": "esmx build", "build:dts": "tsc --declaration --emitDeclarationOnly --outDir dist/src", "preview": "esmx preview", "start": "esmx start" } }
{ "compilerOptions": { "isolatedModules": true, "allowJs": false, "experimentalDecorators": true, "resolveJsonModule": true, "types": [ "@types/node" ], "target": "ESNext", "module": "ESNext", "importHelpers": false, "declaration": true, "sourceMap": true, "strict": true, "noImplicitAny": false, "noImplicitReturns": false, "noFallthroughCasesInSwitch": true, "noUnusedLocals": false, "noUnusedParameters": false, "moduleResolution": "node", "esModuleInterop": true, "skipLibCheck": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, "noEmit": true }, "include": [ "src", "**.ts" ], "exclude": [ "dist" ] }