
simonbo
Modern Front-End Development for Rails - Webpacker and Unexpected token errors
Hello,
While trying to run the code examples from the book I always encounter the same issues that seem to be caused, maybe among other potential suspects, by webpacker.
I mostly get Unexpected token
errors when webpacker tries to compile. It seems that Typescript isn’t well parsed.
By following some of the instructions described in webpacker’s README I managed sometimes before the use of Stimulus and React in the book to make it works. However once both frameworks present, I did not find my way through all those errors, to be honest.
So at this point, I can’t move forward in the book it became quite a struggle to fix here and there potential versions conflicts.
Would not it be interesting to freeze the versions of some gems/library in the Gemfile and the package.json?
Also before trying to run anything in a project directory, yarn always asks to proceed to do an integrity check, a bundle exec rails whatever
can’t be run until it’s done. I don’t know if it can also play in upgrading automatically the versions that aren’t locked and thus maybe cause some issues later on.
error Couldn't find an integrity file
error Found 1 errors.
========================================
Your Yarn packages are out of date!
Please run `yarn install --check-files` to update.
========================================
To disable this check, please change `check_yarn_integrity`
to `false` in your webpacker config file (config/webpacker.yml).
yarn check v1.22.4
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.
Thanks for the help, I really enjoy the book and would love to move forward through the practical aspect.
Simon
Most Liked

noelrappin
So, there are some versioning issues here. My plan has been to wait until the book goes final to lock the versions in the source code – it makes it easier for me to keep up while the book is in progress.
There are issues with Webpacker 5.1 and the Stimulus controllers (see https://github.com/stimulusjs/stimulus/issues/303), and I haven’t incorporated that fix into the book yet, so I’d try fixing Webpacker to ~5.0
and see if that helps.
Popular Prag Prog topics










Other popular topics








Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /centos
- /ash
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /sublime-text
- /textmate
- /react-native
- /kubuntu
- /arch-linux
- /ubuntu
- /revery
- /manjaro
- /spring
- /django
- /diversity
- /nodejs
- /lua
- /c
- /slackware
- /julia
- /neovim