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

Error building the project #517

Closed
r301 opened this issue Mar 30, 2022 · 3 comments
Closed

Error building the project #517

r301 opened this issue Mar 30, 2022 · 3 comments

Comments

@r301
Copy link

r301 commented Mar 30, 2022

Hi, I'm having issues building the project and I wonder if anyone else is experiencing this or if I'm missing some steps.

Steps to Reproduce

  1. Download the code from master (same issue with the 0.14.18 release)
  2. Run "npm install" to install the dependencies
  3. Run "npm run build" to build
  4. Build fails as follow:

For the code from master:
[!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
packages\core\src\Protocol.ts (5:7)
3:
4: // Colyseus protocol codes range between 0~100
5: export enum Protocol {
__________^

For the 0.14.18 release:
[!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
packages\core\src\Server.ts (19:7)
17:
18: // IServerOptions &
19: export type ServerOptions = {
___________^

I have checked and I seem to have all of the rollup plugins installed.
I have tried to downgrade to Typescript 4.2.4 but that didn't change anything.

Context

I'm making some changes to the Colyseus source code and I'm trying to build it so it's easier to manage in the project I'm working on.
I understand this might be an issue with Rollup and Typescript but I am able to run the steps described above and build successfully the colyseus.js client library as well as colyseus/schema. If I run npm install and npm run build, I'm able to generate the build, dist and lib folders for these two modules.

Please let me know if I'm doing anything wrong. Thanks!

Your Environment

  • Colyseus Version: master or 0.14.18
  • Node.js Version: v16.14.0
  • Operating System and version: Windows 10 64bit
  • node_modules installed:
    +-- @colyseus/arena@0.14.24 -> .\packages\arena
    | +-- @colyseus/core@0.14.28 -> .\packages\core
    | +-- @types/cors@2.8.10
    | +-- @types/dotenv@8.2.0
    | +-- cors@2.8.5 deduped
    | +-- dotenv@8.6.0
    | +-- express@4.17.1 deduped
    | -- uwebsockets-express@1.1.10 +-- @colyseus/core@0.14.28 -> .\packages\core | +-- @colyseus/schema@1.0.25 | +-- @gamestdio/timer@1.3.2 | +-- @types/redis@2.8.30 | +-- debug@4.3.2 | +-- internal-ip@4.3.0 | +-- nanoid@2.1.11 | -- notepack.io@2.3.0
    +-- @colyseus/example@0.14.21 -> .\packages\example
    | +-- @colyseus/monitor@0.14.22 -> .\packages\monitor
    | -- colyseus@0.14.23 -> .\bundles\colyseus +-- @colyseus/fossil-delta-serializer@0.14.21 -> .\packages\serializer\fossil-delta-serializer | +-- @colyseus/core@0.14.28 -> .\packages\core | +-- fast-json-patch@2.2.1 | +-- fossil-delta@1.0.2 | -- notepack.io@2.3.0 deduped
    +-- @colyseus/loadtest@0.14.7 -> .\packages\loadtest
    | +-- @types/blessed@0.1.19
    | +-- blessed@0.1.81
    | +-- colyseus.js@0.14.13 deduped
    | +-- minimist@1.2.5 deduped
    | +-- ts-node@7.0.1 deduped
    | +-- typescript@4.3.5 deduped
    | -- ws@7.5.4 +-- @colyseus/mikro-orm-driver@0.14.21 -> .\packages\drivers\mikro-orm-driver | +-- @colyseus/core@0.14.28 -> .\packages\core | -- @mikro-orm/core@4.5.7
    +-- @colyseus/mongoose-driver@0.14.22 -> .\packages\drivers\mongoose-driver
    | +-- @colyseus/core@0.14.28 -> .\packages\core
    | -- mongoose@5.13.2 +-- @colyseus/monitor@0.14.22 -> .\packages\monitor | +-- @colyseus/core@0.14.28 -> .\packages\core | +-- @types/material-ui@0.21.8 | +-- @types/node-os-utils@1.2.0 | +-- @types/react-router-dom@4.3.5 | +-- @types/react@16.14.10 | +-- @types/superagent@3.8.7 | +-- css-loader@0.28.11 | +-- express@4.17.1 deduped | +-- extract-text-webpack-plugin@4.0.0-beta.0 | +-- file-loader@1.1.11 | +-- html-webpack-plugin@3.2.0 | +-- material-ui@0.20.2 | +-- node-os-utils@1.3.5 | +-- react-dom@16.14.0 | +-- react-json-edit@0.3.1 | +-- react-json-view@1.21.3 | +-- react-router-dom@4.3.1 | +-- react@16.14.0 | +-- style-loader@0.20.3 | +-- superagent@3.8.3 | +-- ts-loader@4.5.0 | +-- webpack-cli@3.3.12 | +-- webpack-dev-middleware@3.7.3 | +-- webpack-dev-server@3.11.2 | -- webpack@4.46.0
    +-- @colyseus/redis-driver@0.14.22 -> .\packages\drivers\redis-driver
    | +-- @colyseus/core@0.14.28 -> .\packages\core
    | -- redis@2.8.0 +-- @colyseus/redis-presence@0.14.20 -> .\packages\presence\redis-presence | +-- @colyseus/core@0.14.28 -> .\packages\core | -- redis@2.8.0 deduped
    +-- @colyseus/tcp-transport@0.14.21 -> .\packages\transport\tcp-transport
    | -- @colyseus/core@0.14.28 -> .\packages\core +-- @colyseus/testing@0.14.22 -> .\packages\testing | +-- @colyseus/arena@0.14.24 -> .\packages\arena | +-- @colyseus/core@0.14.28 -> .\packages\core | +-- @colyseus/ws-transport@0.14.21 -> .\packages\transport\ws-transport | +-- colyseus.js@0.14.13 deduped | -- httpie@2.0.0-next.13 deduped
    +-- @colyseus/uwebsockets-transport@0.14.27 -> .\packages\transport\uwebsockets-transport
    | +-- @colyseus/core@0.14.28 -> .\packages\core
    | +-- @colyseus/schema@1.0.25 deduped
    | -- uWebSockets.js@19.2.0 (git+ssh://git@github.com/uNetworking/uWebSockets.js.git#77b1761c5a23ac6a5c2adf2bd808be0ae6b5000a) +-- @colyseus/ws-transport@0.14.21 -> .\packages\transport\ws-transport | +-- @colyseus/core@0.14.28 -> .\packages\core | +-- @colyseus/schema@1.0.25 deduped | +-- @types/ws@7.4.6 | -- ws@7.5.4 deduped
    +-- @lerna/batch-packages@3.16.0
    +-- @lerna/filter-packages@4.0.0
    +-- @lerna/project@4.0.0
    +-- @rollup/plugin-commonjs@17.1.0
    +-- @rollup/plugin-json@4.1.0
    +-- @rollup/plugin-node-resolve@11.2.1
    +-- @rollup/plugin-typescript@8.2.5
    +-- @types/debug@0.0.31
    +-- @types/express@4.17.12
    +-- @types/fossil-delta@1.0.0
    +-- @types/jest@26.0.24
    +-- @types/koa@2.13.3
    +-- @types/mocha@5.2.7
    +-- @types/node@16.3.2
    +-- @types/sinon@10.0.2
    +-- all-contributors-cli@6.20.0
    +-- assert@2.0.0
    +-- benchmark@2.1.4
    +-- bindings@1.5.0 extraneous
    +-- c8@7.7.3
    +-- colyseus.js@0.14.13
    +-- colyseus@0.14.23 -> .\bundles\colyseus
    | +-- @colyseus/core@0.14.28 -> .\packages\core
    | +-- @colyseus/mongoose-driver@0.14.22 -> .\packages\drivers\mongoose-driver
    | +-- @colyseus/redis-presence@0.14.20 -> .\packages\presence\redis-presence
    | -- @colyseus/ws-transport@0.14.21 -> .\packages\transport\ws-transport +-- cors@2.8.5 +-- express@4.17.1 +-- file-uri-to-path@1.0.0 extraneous +-- httpie@2.0.0-next.13 +-- jest@27.0.6 +-- koa@2.13.1 +-- lerna@4.0.0 +-- minimist@1.2.5 +-- mocha@5.2.0 +-- nan@2.14.2 extraneous +-- rimraf@2.7.1 +-- rollup-plugin-node-externals@2.2.0 +-- rollup@2.52.7 +-- sinon@11.1.1 +-- ts-jest@27.0.3 +-- ts-node-dev@1.1.8 +-- ts-node@7.0.1 +-- tslint@5.20.1 -- typescript@4.3.5
@endel
Copy link
Member

endel commented Mar 30, 2022

Hi @r301, there's another step required before building:

  • npm install
  • npm run boot
  • npm run build

Let me know if that works for you.

It used to be easier to fork and make changes to Colyseus before we adopted a monorepo structure. If you have any ideas to make it easier to make manual changes and consume the forked module I'm open to suggestions. Cheers!

@endel
Copy link
Member

endel commented Mar 30, 2022

On a second thought, I think this error is related to Windows and @rollup/plugin-typescript: rollup/plugins#1083

@r301
Copy link
Author

r301 commented Mar 30, 2022

Hi @endel, gotcha! Good to know all the steps, although it didn't solve the issue.
I think you are right, it is a Windows + @rollup/plugin-typescript issue.

Because you mentioned Windows, I assumed there was no issue on Mac and sure enough, I was able to build the project using the Windows Subsystem for Linux!
I'll work with that for now :) Thanks a lot 👍 !

@r301 r301 closed this as completed Mar 30, 2022
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

2 participants