Stimulus Discourse

Lynda.com Course — need help with Syntax targets error


#1

I’m taking Learning Stimulus on Lynda.com and I’m stuck at the last section in Chapter 3 getting the error with caret pointing to equals sign:

WARNING in ./src/controllers/card_controller.js
Module build failed: SyntaxError: Unexpected token (4:19)

export default class extends Controller {
    static targets = ["name"];

My error is similar to this Discourse discussion, but I believe the setup on Lynda is sufficiently different. I’ve also tried with the course-supplied example code and get the same error.

Has anyone else taken this course on Lynda, or have you seen this error before and can explain why this error occurs and how to resolve it?


#2

I’m not familiar with the course on lynda.com, but this error looks familiar. Do you use the plugin-proposal-class-properties plugin for Babel? If not, then give it a try. Also, check the installation instructions for Stimulus.