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

jimschubert
In Chapter 3, the source for index introduces Config on page 31, followed by more code including tests; Config isn’t introduced until pag...
New
belgoros
Following the steps described in Chapter 6 of the book, I’m stuck with running the migration as described on page 84: bundle exec sequel...
New
jdufour
Hello! On page xix of the preface, it says there is a community forum "… for help if your’re stuck on one of the exercises in this book… ...
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
New
curtosis
Running mix deps.get in the sensor_hub directory fails with the following error: ** (Mix) No SSH public keys found in ~/.ssh. An ssh aut...
New
jskubick
I’m under the impression that when the reader gets to page 136 (“View Data with the Database Inspector”), the code SHOULD be able to buil...
New
adamwoolhether
Is there any place where we can discuss the solutions to some of the exercises? I can figure most of them out, but am having trouble with...
New
s2k
Hi all, currently I wonder how the Tailwind colours work (or don’t work). For example, in app/views/layouts/application.html.erb I have...
New
mcpierce
@mfazio23 I’ve applied the changes from Chapter 5 of the book and everything builds correctly and runs. But, when I try to start a game,...
New

Other popular topics Top

AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
New
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
New
AstonJ
Inspired by this post from @Carter, which languages, frameworks or other tech or tools do you think is killing it right now? :upside_down...
New
AstonJ
I have seen the keycaps I want - they are due for a group-buy this week but won’t be delivered until October next year!!! :rofl: The Ser...
New
AstonJ
In case anyone else is wondering why Ruby 3 doesn’t show when you do asdf list-all ruby :man_facepalming: do this first: asdf plugin-upd...
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
New
PragmaticBookshelf
Author Spotlight: Sophie DeBenedetto @SophieDeBenedetto The days of the traditional request-response web application are long gone, b...
New
AstonJ
Curious what kind of results others are getting, I think actually prefer the 7B model to the 32B model, not only is it faster but the qua...
New

Sub Categories: