question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

webpack + babel support

See original GitHub issue

Trying to implement the new schema introduced by v0.10 I was stuck on error: SchemaSerializer error. See: https://docs.colyseus.io/migrating/0.10/#new-default-serializer.

The thing is I was using the new schema so I started debugging.

It turns out I was missing a room decorator: @serialize(SchemaSerializer) which isn’t mentioned anywhere in docs that you have to use.

The only context this decorator is mentioned in is with fossil serializer.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
Mykybocommented, May 17, 2019

@endel The changes to the config in https://github.com/endel/coly-test/commit/c45d9d1ce6ce16b7a5db7b16f4f88ac6c599ce8e do allow the project to be compiled, room to be created and clients to join, however, state updates are not sent to client.

When I compile the same project with tsc, the updates start working.

1reaction
endelcommented, Apr 18, 2019

I’ve been playing around with this today, and I’ve managed to get rid of the SchemaSerializer error using this configuration: https://github.com/endel/coly-test/commit/c45d9d1ce6ce16b7a5db7b16f4f88ac6c599ce8e

The problem is deeper than it seems, though. Babel currently cannot play nicely with TypeScript’s (“legacy”) decorators, here are some relevant issues on their issue tracker:

I believe the root of this issue is because of the initializerDefineProperty_default calls generated by Babel, here:

let TestRoom_State = (_dec = Object(schema_["type"])("string"), _dec2 = Object(schema_["type"])("number"), (_class = (_temp = class State extends schema_["Schema"] {
  constructor() {
    super(...arguments);

    initializerDefineProperty_default()(this, "someAtr", _descriptor, this);
//...

Unfortunately I don’t know how high is for the Babel team to fix this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

babel-loader - webpack
Webpack supports bundling multiple targets. For cases where you may want different Babel configurations for each target (like web and node ), this...
Read more >
How to Webpack 5 with Babel - Setup Tutorial
A step by step tutorial on how to integrate Babel into Webpack to access powerful JavaScript features (ES6, ES7, ES8, ES9) from the...
Read more >
Using Babel and Webpack - ECMAScript 6 Tutorial
Open a command prompt, and navigate ( cd ) to the es6-tutorial-data directory. Type the following command to install the Babel and Webpack...
Read more >
Why and How to Use Webpack and Babel with Vanilla JS
Advantages of Using Webpack and Babel with Vanilla JS. Removes unused and unnecessary assets from the code, making it cleaner. Makes the code ......
Read more >
BabelJS - Working with Babel and Webpack - Tutorialspoint
BabelJS - Working with Babel and Webpack, Webpack is a module bundler which packs all modules with dependencies – js, styles, images, etc....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found