skyrocket icon indicating copy to clipboard operation
skyrocket copied to clipboard

Support for the experimental syntax 'classProperties' isn't currently enabled

Open NullVoxPopuli opened this issue 5 years ago • 2 comments

Got this error on some of my supporting code

doctor-who-ai/workers/ai/game.js: Support for the experimental syntax 'classProperties' isn't currently enabled (28:8):

  26 | export function fakeGameFrom(model) {
  27 |   class FakeInputManager {
> 28 |     on = voidFn;
     |        ^
  29 |   }
  30 | 
  31 |   class FakeActuator {

Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-class-properties (https://git.io/vb4yQ) to the 'plugins' section to enable parsing.

maybe a bigger question here, is why is this trying to be transpiled anyway? my target browsers (latest chrome and firefox) support class properties?

trace
Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-class-properties (https://git.io/vb4yQ) to the 'plugins' section to enable parsing.
    at Parser._raise (/home/lprestonsegoiii/Development/NullVoxPopuli/doctor-who-thirteen-game-ai/doctor-who-ai/node_modules/@babel/parser/lib/index.js:757:17)
    at Parser.raiseWithData (/home/lprestonsegoiii/Development/NullVoxPopuli/doctor-who-thirteen-game-ai/doctor-who-ai/node_modules/@babel/parser/lib/index.js:750:17)
    at Parser.expectPlugin (/home/lprestonsegoiii/Development/NullVoxPopuli/doctor-who-thirteen-game-ai/doctor-who-ai/node_modules/@babel/parser/lib/index.js:8839:18)
    at Parser.parseClassProperty (/home/lprestonsegoiii/Development/NullVoxPopuli/doctor-who-thirteen-game-ai/doctor-who-ai/node_modules/@babel/parser/lib/index.js:12232:12)
    at Parser.pushClassProperty (/home/lprestonsegoiii/Development/NullVoxPopuli/doctor-who-thirteen-game-ai/doctor-who-ai/node_modules/@babel/parser/lib/index.js:12192:30)
    at Parser.parseClassMemberWithIsStatic (/home/lprestonsegoiii/Development/NullVoxPopuli/doctor-who-thirteen-game-ai/doctor-who-ai/node_modules/@babel/parser/lib/index.js:12125:14)
    at Parser.parseClassMember (/home/lprestonsegoiii/Development/NullVoxPopuli/doctor-who-thirteen-game-ai/doctor-who-ai/node_modules/@babel/parser/lib/index.js:12062:10)
    at /home/lprestonsegoiii/Development/NullVoxPopuli/doctor-who-thirteen-game-ai/doctor-who-ai/node_modules/@babel/parser/lib/index.js:12007:14
    at Parser.withTopicForbiddingContext (/home/lprestonsegoiii/Development/NullVoxPopuli/doctor-who-thirteen-game-ai/doctor-who-ai/node_modules/@babel/parser/lib/index.js:11078:14)
    at Parser.parseClassBody (/home/lprestonsegoiii/Development/NullVoxPopuli/doctor-who-thirteen-game-ai/doctor-who-ai/node_modules/@babel/parser/lib/index.js:11984:10)

NullVoxPopuli avatar Jul 11 '20 10:07 NullVoxPopuli

maybe this is a rollup issue? looking here: https://github.com/html-next/skyrocket/blob/master/packages/compiler/src/plugin/rollup.ts#L53

~looks like babel isn't used? should that be added?~

looks like babel is used, but has some weird configuration pulled from somewhere?

NullVoxPopuli avatar Jul 11 '20 11:07 NullVoxPopuli

I can "get past this" but converting my classes to pre class properties myself

eg

  class FakeInputManager {
    constructor() {
      this.on = voidFn;
    }
  }

NullVoxPopuli avatar Jul 11 '20 11:07 NullVoxPopuli