TypeScript/Compilation errors
If you haven't created your Colyseus application via npm create colyseus-app@latest
, make sure your tsconfig.json
is configured as follows:
{
"compilerOptions": {
"outDir": "build",
"target": "ESNext",
"module": "CommonJS",
"moduleResolution": "node",
"strict": true,
"allowJs": true,
"strictNullChecks": false,
"esModuleInterop": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"useDefineForClassFields": false
},
"include": [
"src"
]
}
Make sure you are able to compile your application locally before deploying it to Colyseus Cloud:
Disabling TypeScript strict mode (not recommended)¶
You can disable TypeScript strict mode by modifying the following configuration to your tsconfig.json
. (This is not recommend as it will make your application more prone to runtime errors.)
Monorepo setup (advanced)¶
If you are using a monorepo setup, we recommend using the pnpm
package manager instead of npm
. (See pnpm docs for more information)
Configure your workspaces¶
pnpm
requires you to configure your workspaces in a pnpm-workspace.yaml
file. See example below:
packages:
# all packages in direct subdirs of packages/
- 'packages/*'
# all packages in subdirs of components/
- 'components/**'
# exclude packages that are inside test directories
- '!**/test/**'
Installing dependencies¶
Before installing your dependencies with pnpm
, make sure to remove node_modules
and package-lock.json
from your previous package manager from your project.
Push pnpm-lock.yaml
and pnpm-workspace.yaml
Make sure to push the pnpm-lock.yaml
and pnpm-workspace.yaml
files to your repository, so Colyseus Cloud can install your dependencies correctly.