Skip to content

Commit 11bd9a1

Browse files
committed
Update readme
1 parent 52bc184 commit 11bd9a1

File tree

1 file changed

+6
-53
lines changed

1 file changed

+6
-53
lines changed

README.md

Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -63,55 +63,16 @@ Recommended in **package.json** for correct consumption:
6363
npm install @workadventure/map-starter-kit-core
6464
```
6565

66-
**2. Import the Express app (ESM)**
66+
**2. Import and use it with vite node app plugin**
6767

6868
```ts
69-
import core from "@workadventure/map-starter-kit-core";
69+
import core from '@workadventure/map-starter-kit-core/dist/server.js';
7070

71-
const app = core.default; // or core.viteNodeApp (same Express Application)
72-
73-
app.listen(3000, () => console.log("Listening on 3000"));
74-
```
75-
76-
**3. Or use the explicit entry (same result)**
77-
78-
```ts
79-
import core from "@workadventure/map-starter-kit-core/dist/server.js";
80-
```
81-
82-
**4. TypeScript**
83-
84-
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.
85-
86-
**5. CommonJS**
87-
88-
```ts
89-
const core = require("@workadventure/map-starter-kit-core");
90-
const app = core.default;
91-
```
92-
93-
**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.
94-
95-
---
96-
97-
## Usage
98-
99-
### As a dependency (programmatic)
100-
101-
Use the built Express app in your own server:
102-
103-
```ts
104-
import core from "@workadventure/map-starter-kit-core";
105-
106-
const app = core.default; // or core.viteNodeApp
107-
108-
// Mount or start your server
109-
app.listen(3000, () => console.log("Listening on 3000"));
71+
export default core.default;
72+
export const viteNodeApp = core.viteNodeApp;
11073
```
11174

112-
Types are provided via `dist/server.d.ts`: `core` is typed as `{ default: Application; viteNodeApp: Application }`.
113-
114-
### Development server (standalone)
75+
**3. Development server (standalone)**
11576

11677
From the **map-starter-kit** repo (or a project that uses this package as the core):
11778

@@ -121,15 +82,7 @@ npm run dev
12182

12283
Runs the Vite dev server with vite-plugin-node (Express). Opens the app at the configured host (e.g. `http://localhost:5173/`).
12384

124-
### Build for production
125-
126-
```bash
127-
npm run build
128-
```
129-
130-
- Runs `tsc` (type-check only; `noEmit: true` in tsconfig)
131-
- Builds the server bundle with Vite into `dist/server.js`
132-
- Copies `types/server.d.ts` to `dist/server.d.ts` for published types
85+
---
13386

13487
## Project structure
13588

0 commit comments

Comments
 (0)