You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use vite_rails in a Rails 8 app that hosts multiple Rails engines (monorepo style).
Each engine may provide its own JavaScript entrypoints.
After a fresh install of vite_rails, I configured vite.json to watch entrypoints inside engines/**/app/javascript/entrypoints/**/*.
When I call <%= vite_javascript_tag 'workflows' %>, I get:
Vite Ruby can't find entrypoints/workflows.js in the manifests.
So it seems vite_rails doesn't normalize the manifest keys when entrypoints are outside sourceCodeDir.
Environment
Rails 8.0.0
vite_rails 3.9.2
Ruby 3.x
Engines located under /engines/*/app/javascript/entrypoints
Notes
If I move workflows.js into the main app/javascript/entrypoints, it works as expected.
But we want each engine to keep its own JS entrypoints (engines/workflows, engines/documents, etc.).
The file is built by Vite, but vite_rails can’t find it due to the manifest key.
Question
Is this a bug or a configuration issue?
Should additionalEntrypoints strip the engine path prefix so we can reference the entrypoint by its basename (like workflows)?
Or should we instead reference it with the full path (engines/workflows/app/javascript/entrypoints/workflows.js) in vite_javascript_tag?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello Team!
I'm trying to use vite_rails in a Rails 8 app that hosts multiple Rails engines (monorepo style).
Each engine may provide its own JavaScript entrypoints.
After a fresh install of vite_rails, I configured
vite.json
to watch entrypoints insideengines/**/app/javascript/entrypoints/**/*
.Here is my
vite.json
:My engine has an entrypoint file at:
In the engine layout I try to load it:
Expected behavior
I expected vite_rails to resolve
workflows.js
and include it in the layout (just likeapplication.js
from the main app).Actual behavior
Vite builds the file, but the manifest key looks like this:
When I call
<%= vite_javascript_tag 'workflows' %>
, I get:So it seems vite_rails doesn't normalize the manifest keys when entrypoints are outside
sourceCodeDir
.Environment
/engines/*/app/javascript/entrypoints
Notes
workflows.js
into the mainapp/javascript/entrypoints
, it works as expected.Question
Is this a bug or a configuration issue?
Should
additionalEntrypoints
strip the engine path prefix so we can reference the entrypoint by its basename (likeworkflows
)?Or should we instead reference it with the full path (
engines/workflows/app/javascript/entrypoints/workflows.js
) invite_javascript_tag
?Thanks a lot for your help!
Beta Was this translation helpful? Give feedback.
All reactions