Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible install instruction change needed for Webpacker 6 #48

Closed
noelrappin opened this issue Dec 27, 2020 · 6 comments
Closed

Possible install instruction change needed for Webpacker 6 #48

noelrappin opened this issue Dec 27, 2020 · 6 comments

Comments

@noelrappin
Copy link

I was trying to run the install instructions against the Webpacker 6 beta.

Taking my example which already worked against Webpacker 5, and upgrading Webpacker, my Turbo install was no longer downloading. (The links that had been identified in the log as being processed as TURBO_STREAM no longer were, the behavior was no longer working, and Turbo was no longer in the sources tab).

Adding a console.log(Turbo) to the application.js file makes everything work again, so I guess I'd assume that the switch to Webpacker 6 and the javascript_packs_with_chunks_tag helper somehow doesn't realize that Turbo is being used and therefore doesn't download it with the pack?

Is there a preferred way of managing this?

Thanks!

@dhh
Copy link
Member

dhh commented Dec 28, 2020

Sounds like Webpack is shaking its tree and not finding any usages of Turbo in the pack itself. @javan any idea how we might stop this from happening? Maybe with Webpack we shouldn't have the lib call start() itself.

@styrmis
Copy link

styrmis commented Dec 29, 2020

I'm experiencing the same with webpacker 5.1.1. To get around it I've added a Turbo.start() call after the import, as it looks like this should have no effect beyond persuading Webpack to keep Turbo in the tree.

I'm only using javascript_pack_tag, not javascript_packs_with_chunks_tag.

@javan
Copy link
Contributor

javan commented Dec 29, 2020

Does this "fix" it?

- import { Turbo, cable } from "@hotwired/turbo-rails"
+ import "@hotwired/turbo-rails"

@styrmis
Copy link

styrmis commented Dec 29, 2020

Does this "fix" it?

- import { Turbo, cable } from "@hotwired/turbo-rails"
+ import "@hotwired/turbo-rails"

Yes, this works fine.

@noelrappin
Copy link
Author

Yeah that worked for me under Webpacker 6 beta also.

@chmich
Copy link

chmich commented Apr 27, 2023

Thanks, same for vite

For Turbo itself, this was not necessary, but ActionCable only worked in this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants