boardgameio / boardgame.io

State Management and Multiplayer Networking for Turn-Based Games
https://boardgame.io
MIT License
9.93k stars 704 forks source link

Using without react ? #1165

Open LelouBil opened 9 months ago

LelouBil commented 9 months ago

I just started a new project with only boardgame.io using bun and upon running this simple file :

import {Server} from "boardgame.io/server";
import {Origins} from "boardgame.io/server";

const server = Server({
    // Provide the definitions for your game(s).
    games: [],

    // Provide the database storage class to use.
    db: new DbConnector(),

    origins: [Origins.LOCALHOST_IN_DEVELOPMENT],
});

server.run(8000);

I get this error error: Cannot find package "react" from "/<project-folder>/node_modules/boardgame.io/dist/boardgameio.js"

psalaets commented 9 months ago

I'm not completely sure why or if this matters, but this is the import statement I use

import { Origins, Server } from 'boardgame.io/server';

Quickly scanning through my codebase, I've noticed that the only imports from boardgame.io are type imports. Everything else is imported using boardgame.io/<something>.

LelouBil commented 9 months ago

Yes, my bad. I uploaded the wrong version. I'll fix the issue.

And I also want to mention that I switch to just using node, and I'm facing the same issue, that boardgame.io can't be used without react installed