Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

200
Vistas
Rails stimulus-autocomplete Errors - Uncaught Error: Module parse failed - Static Targets

I'm still relatively new to the Rails game, but I was wondering whether anyone could assist with a problem that I have.

I wanted to implement [stimulus-autocomplete][1] into my rails 6 app, but when I follow the instructions laid out, I get an error in my console, and I'm not sure how to fix it.

My javascript/controllers/index.js file looks like so:

import { Application } from "stimulus"
import { definitionsFromContext } from "stimulus/webpack-helpers"
import { Autocomplete } from 'stimulus-autocomplete'

const application = Application.start()
const context = require.context("controllers", true, /_controller\.js$/)
application.load(definitionsFromContext(context))
application.register('autocomplete', Autocomplete)

I've run yarn add stimulus-autocomplete and rebooted my server, but I now get the following error in the console:

Uncaught Error: Module parse failed: Unexpected token (7:17)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| 
| export default class Autocomplete extends Controller {
>   static targets = ["input", "hidden", "results"]
|   static classes = ["selected"]
|   static values = {
    at ./node_modules/stimulus-autocomplete/src/autocomplete.js (bootstrap.esm.js:4999:1)
    at __webpack_require__ (bootstrap:19:1)
    at ./app/javascript/controllers/index.js (index.js:1:1)
    at __webpack_require__ (bootstrap:19:1)
    at ./app/javascript/packs/application.js (application.js:1:1)
    at __webpack_require__ (bootstrap:19:1)
    at bootstrap:83:1
    at bootstrap:83:1

I think it's an issue with the static targets themselves and possibly something to do with support in ES6, but I haven't been able to find a solution.

I'm using webpack on the application.

If anyone has any pointers, it's much appreciated!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda