Babel ES7 Leading decorators must be attached to a class declaration

If you ever find yourself seeing this error, the solution is very simple. Remove the semicolon behind your attributes.

Example

As an example, here’s the (current) default app.js from Aurelia. I’ve introduced the bug on line 7.

Upon adding a semicolon behind your decorator (@inject(Router)) you’ll find yourself having above error. So, to fix the error simply remove the semicolon.

3 Comments

Add yours →

  1. You are a live saver. : D

1 Pingback

  1. URL

Leave a Reply


eight − = 2

©SpoonX 2017