simonbo

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. :slight_smile:

Simon

Most Liked

noelrappin

noelrappin

Author of Modern Front-End Development for Rails

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.

Where Next?

Popular Pragmatic Bookshelf topics Top

New
kuroneko
Whilst the author has been careful to provide exact results for the tests elsewhere in the book (such as surds with the transformation te...
New
raul
Page 28: It implements io.ReaderAt on the store type. Sorry if it’s a dumb question but was the io.ReaderAt supposed to be io.ReadAt? ...
New
herminiotorres
Hi! I know not the intentions behind this narrative when called, on page XI: mount() |> handle_event() |> render() but the correc...
New
rmurray10127
Title: Intuitive Python: docker run… denied error (page 2) Attempted to run the docker command in both CLI and Powershell PS C:\Users\r...
New
kolossal
Hi, I need some help, I’m new to rust and was learning through your book. but I got stuck at the last stage of distribution. Whenever I t...
New
mert
AWDWR 7, page 152, page 153: Hello everyone, I’m a little bit lost on the hotwire part. I didn’t fully understand it. On page 152 @rub...
New
New
redconfetti
Docker-Machine became part of the Docker Toolbox, which was deprecated in 2020, long after Docker Desktop supported Docker Engine nativel...
New
dachristenson
@mfazio23 Android Studio will not accept anything I do when trying to use the Transformations class, as described on pp. 140-141. Googl...
New

Other popular topics Top

AstonJ
If it’s a mechanical keyboard, which switches do you have? Would you recommend it? Why? What will your next keyboard be? Pics always w...
New
ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
PragmaticBookshelf
A PragProg Hero’s Journey with Brian P. Hogan @bphogan Have you ever worried that your only legacy will be in the form of legacy...
New
AstonJ
Or looking forward to? :nerd_face:
New
AstonJ
There’s a whole world of custom keycaps out there that I didn’t know existed! Check out all of our Keycaps threads here: https://forum....
New
AstonJ
Do the test and post your score :nerd_face: :keyboard: If possible, please add info such as the keyboard you’re using, the layout (Qw...
New
Rainer
Not sure if following fits exactly this thread, or if we should have a hobby thread… For many years I’m designing and building model air...
New
dimitarvp
Small essay with thoughts on macOS vs. Linux: I know @Exadra37 is just waiting around the corner to scream at me “I TOLD YOU SO!!!” but I...
New
Maartz
Hi folks, I don’t know if I saw this here but, here’s a new programming language, called Roc Reminds me a bit of Elm and thus Haskell. ...
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New

Sub Categories: