You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+96-13Lines changed: 96 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,83 @@ Core app, HTML pages and static assets for the **WorkAdventure Map Starter Kit**
16
16
npm install @workadventure/map-starter-kit-core
17
17
```
18
18
19
-
**Peer / consumer:** The built server expects `express` to be available at runtime. For TypeScript consumers, `@types/express` is used for the exported `Application` type.
19
+
**Peer / consumer:** The built server expects `express` to be available at runtime. For TypeScript consumers, install `@types/express` so the exported `Application` type resolves.
20
+
21
+
---
22
+
23
+
## Package exports and usage from another package
24
+
25
+
This package is built and published as a **single server bundle**. Consumers must use the built output, not the source, to avoid module resolution errors.
26
+
27
+
### How exports are managed
28
+
29
+
| Field | Role |
30
+
|--------|------|
31
+
|**`main`**| Entry when a tool doesn’t use `exports`. Should point to `dist/server.js` so the bundle is used, not `src/server.ts`. |
32
+
|**`types`**| Tells TypeScript which declaration file to use for the package entry (`dist/server.d.ts`). |
33
+
|**`exports`**| Modern entry map: `"."` and `"./dist/server.js"` resolve to `dist/server.js` with types `dist/server.d.ts`. |
34
+
|**`files`**| What gets published: `dist`, `public`, `README.md`. Source (`src/`) is not published so consumers never resolve to `.ts` files. |
35
+
36
+
Recommended in **package.json** for correct consumption:
Types come from `dist/server.d.ts`: the default export is typed as `{ default: Application; viteNodeApp: Application }`. Ensure the consuming project has `express` and `@types/express` so the `Application` type resolves.
**Important:** Do not import from `@workadventure/map-starter-kit-core/src/server` or rely on `src/` in the package. Only the built `dist/server.js` and its types are the supported contract.
Only `dist`, `public`, and `README.md` are included in the published package (`files`). Source (`src/`) is not published so consumers always get the built bundle.
0 commit comments