afcapel / stimulus-autocomplete

Stimulus autocomplete component
MIT License
482 stars 63 forks source link

Module parse failed: Unexpected token error #90

Closed extendednotes closed 2 years ago

extendednotes commented 2 years ago

Unfortunately I do get the following error message from webpacker with the latest rc5 version:

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. | | export default class Autocomplete extends Controller {

static targets = ["input", "hidden", "results"] | static classes = ["selected"] | static values = {

Does anyone know how to solve this? Thx in advance!

afcapel commented 2 years ago

@extendednotes what version of webpacker are you using? This example rails app works fine with rc5 and webpacker v5 with default settings.

extendednotes commented 2 years ago

Hey @afcapel, thanks for your great work and your quick reply. I'm on the latest rails/webpacker version (5.4.3) which still depens on webpack@4.46.0.

afcapel commented 2 years ago

The example app also uses webpack@4.46.0.

There must some difference in the webpacker config. Maybe compare both webpacker.yml files and see if you spot anything.

extendednotes commented 2 years ago

Okay, I'm sorry that was my fault. I just found out, that I probably excluded node_modulues from babel-loader manually a long time ago with "environment.loaders.delete('nodeModules')" in environment.js Thanks again for pointing me in the right direction.

afcapel commented 2 years ago

No worries, glad it's working now.