GitHub Documentation Patreon donate button

Cannot find module './rooms/room2



  • Hi, i'm trying to build a project with multiple chat-rooms on it, each room has a different front web on it
    so i pulled the colyseus/colyseus-examples from GH to try and managed to open the example rooms and modify their fronts. (love your work btw)
    but now i want to have 01-chat-room multiple times, like 02-chat-room, 03 and so on...
    so i copy pasted my rooms/01-chat-room.ts into rooms/02-chat-room.ts, as well as the static/01-chat-room.html in a static/02-chat-room.html
    in the index.ts i also copyed the snippets involving ChatRoom, which is imported from ./rooms/01... as
    export class ChatRoom extends Room {
    and pasted as involving ChatRoom2, which is the class imported from ./rooms/02... as
    export class ChatRoom2 extends Room {

    `

    import { ChatRoom } from "./rooms/01-chat-room";
    import { ChatRoom2 } from "./rooms/02-chat-room";

    gameServer.define("chat", ChatRoom)
    .enableRealtimeListing();

    gameServer.define("chat_with_options", ChatRoom, {
    custom_options: "you can use me on Room#onCreate"
    });

    gameServer.define("chat", ChatRoom2)
    .enableRealtimeListing();

    gameServer.define("chat_with_options", ChatRoom2, {
    custom_options: "you can use me on Room#onCreate"
    });

    `

    i thought it would be that easy but it's not, i must have forgot a step
    please tell me which one

    now when i npm start, the server says :

    TSError: ⨯ Unable to compile TypeScript:
    index.ts:12:27 - error TS2307: Cannot find module './rooms/02-chat-room'.

    12 import { ChatRoom2 } from "./rooms/02-chat-room";

    //

    thanks for help
    luv from france


 

GitHub Documentation Patreon donate button

© 2020 Endel Dreyer