How to properly separate entrypoints (traditional Rails vs. Inertia) #553
-
ProblemI have a Rails 7 app running Vite for both Inertia and "traditional Rails" with Turbolinks and sometimes (randomly?) Turbolinks intercepts my Inertia links even though the entrypoints are completely independent. QuestionIf I have two different entrypoints that are completely separated ( BackgroundI have a Rails 7 app I migrated from Webpacker to Vite. This app has some pages that are served by "traditional" rails views with Turbolinks and some that are served using Inertia + React. The inertia part has it's own entrypoint and layout that does not include TurboLinks. Here is the inerta html layout:
In what is the weirdest thing ever, when I stop my app, run a different app locally that bundles with Vite, kill that app, and try to start my app again, Turbolinks is loaded on my inertia pages. It's hijacking my inertia links, so definitely a problem. I have tried every combination of My vite config
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi Colleen! Something that might be happening is that some of the imports inside |
Beta Was this translation helpful? Give feedback.
-
Thanks! Disabling turbolinks did the trick. |
Beta Was this translation helpful? Give feedback.
Hi Colleen!
Something that might be happening is that some of the imports inside
inertia.js
end up importing some of the files that import turbolinks. In that scenario, even if unused, because turbolinks is not a "pure" library it wouldn't be tree-shaken and would end up in the bundle.