hotwired / turbo-rails

Use Turbo in your Ruby on Rails app
https://turbo.hotwired.dev
MIT License
2.13k stars 329 forks source link

Minify Issue after updating from 8.0.5 to 8.0.6 with turbo-rails 8.0.5 to 8.0.9 #677

Closed izu23 closed 1 month ago

izu23 commented 2 months ago

I updated the following in my Ruby on Rails application:

Ruby from 3.3.4 to 3.3.5 @hotwired/turbo-rails from 8.0.5 to 8.0.9 @hotwired/turbo from 8.0.5 to 8.0.6

Since then, I have encountered the following error when running the following build command:

"build": "esbuild app/javascript/application.js --bundle --minify --sourcemap --format=esm --outdir=app/assets/builds --public-path=/assets"

here is the error in chrome dev tools:

`TypeError: ya is not a function at ga (application-d5a03decd2bd9279296b1b2ff8e830402602a10d03729eb393ef1d31d14bb401.js:6:3019) at pi (application-d5a03decd2bd9279296b1b2ff8e830402602a10d03729eb393ef1d31d14bb401.js:6:3098) at Qn.canPrefetchRequestToLocation (application-d5a03decd2bd9279296b1b2ff8e830402602a10d03729eb393ef1d31d14bb401.js:20:37313) at #i (application-d5a03decd2bd9279296b1b2ff8e830402602a10d03729eb393ef1d31d14bb401.js:20:18978) ga @ application-d5a03decd2bd9279296b1b2ff8e830402602a10d03729eb393ef1d31d14bb401.js:6 pi @ application-d5a03decd2bd9279296b1b2ff8e830402602a10d03729eb393ef1d31d14bb401.js:6 canPrefetchRequestToLocation @ application-d5a03decd2bd9279296b1b2ff8e830402602a10d03729eb393ef1d31d14bb401.js:20

i @ application-d5a03decd2bd9279296b1b2ff8e830402602a10d03729eb393ef1d31d14bb401.js:20`

If I don't minify my application file with Turbo, it works fine. Is this a problem related to the update?

izu23 commented 2 months ago

The problem lies with esbuilding. When I use --tree-shaking=false, the error no longer occurs. But it only is a Problem after the recent update,

Petercopter commented 2 months ago

@izu23 I'm using a similar setup, same build step. Just upgraded, not seeing that error.

Node 22.8.0

dhh commented 2 months ago

cc @jorgemanrubia

jorgemanrubia commented 2 months ago

Hey folks I released 8.0.10 today for both turbo and turbo-rails. Is the problem still happening with this one?

izu23 commented 1 month ago

after using nvm 22.8.0 it works.