Skip to content

fix(padrino): avoid ActiveSupport's try - #635

Open
osbre wants to merge 1 commit into
ElMassimo:mainfrom
osbre:fix-padrino-preload-try
Open

osbre wants to merge 1 commit into
ElMassimo:mainfrom
osbre:fix-padrino-preload-try

Conversation

@osbre

@osbre osbre commented Oct 13, 2026

Copy link
Copy Markdown

Description 📖

This pull request fixes a NoMethodError in vite_padrino when an entrypoint imports a shared chunk.

Background 📜

This was happening because vite_preload_tag calls try(:request), and try comes from ActiveSupport, which Padrino doesn't load. Vite emits a modulepreload tag whenever two entrypoints import the same module, so any such app crashes when rendering vite_javascript_tag:

NoMethodError - undefined method 'try' for an instance of App

The Fix 🔨

By changing the try calls to plain respond_to? checks. Early hints are still sent when the request supports them.

Screenshots 📷

N/A. Tested with a generated Padrino app with two entrypoints sharing a module, after vite build: before, a 500 error; after, a 200 with the <link rel="modulepreload"> tag rendered.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant