Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies within monorepo are not loaded #453

Open
philihp opened this issue Feb 21, 2023 · 0 comments
Open

Dependencies within monorepo are not loaded #453

philihp opened this issue Feb 21, 2023 · 0 comments

Comments

@philihp
Copy link
Contributor

philihp commented Feb 21, 2023

Hathora is not loading installing dependencies from packages within the monorepo

Demo repo: https://github.com/philihp/hathora-et-labora/tree/69b1a8dfe3828544a1580d35ff0eef46c679057f

The package has a dependency declared at https://github.com/philihp/hathora-et-labora/blob/69b1a8dfe3828544a1580d35ff0eef46c679057f/game/package.json
and loaded at
https://github.com/philihp/hathora-et-labora/blob/69b1a8dfe3828544a1580d35ff0eef46c679057f/game/src/commands/start.ts

file:///Users/philihp/work/hathora-et-labora/game/src/commands/start.ts:34
  const shuffledColors = fastShuffle(playerOrderSeed, colors)
                         ^
TypeError: fastShuffle is not a function
    at start (file:///Users/philihp/work/hathora-et-labora/game/src/commands/start.ts:34:26)
    at handler (file:///Users/philihp/work/hathora-et-labora/game/src/reducer.ts:101:7)
    at n.run (file:///Users/philihp/work/hathora-et-labora/game/node_modules/ts-pattern/src/match.ts:162:12)
    at n.e.otherwise (file:///Users/philihp/work/hathora-et-labora/game/node_modules/ts-pattern/src/match.ts:131:7)
    at reducer (file:///Users/philihp/work/hathora-et-labora/game/src/reducer.ts:106:6)
    at Impl.start (file:///Users/philihp/work/hathora-et-labora/server/impl.ts:88:22)
    at ImplWrapper._getResult (file:///Users/philihp/work/hathora-et-labora/server/.hathora/wrapper.ts:50:21)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ImplWrapper.getResult (file:///Users/philihp/work/hathora-et-labora/server/.hathora/wrapper.ts:29:17)
    at async Store.onMessage (file:///Users/philihp/work/hathora-et-labora/server/.hathora/store.ts:106:22)

Specifically for this case, I could dependency-inject a chance.js from impl, but the problem will still exist for other dependencies.

Could you advise what the correct way to include dependencies in a game is? Should game logic be kept as external dependencies?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant