rails / jsbundling-rails

Bundle and transpile JavaScript in Rails with esbuild, rollup.js, or Webpack.
MIT License
831 stars 143 forks source link

ActionView::Template::Error (The asset "application.js" is not present in the asset pipeline): #168

Closed RailsCod3rFuture closed 1 year ago

RailsCod3rFuture commented 1 year ago

Having an issue on rails 6.0.3 -- Locally, the application.js file is found without issue / all assets load. (I'm using webpacker, btw for jsbundling) I don't know why the gem is failing to load application.js during deployment. I'll show my code below.

ruby 2.7.7 rails 6.0.3 jsbundling-rails 1.1.2

application.html.erb

<head>
<%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
</head>

assets/config/manifest.js

//= link_tree ../builds
//= link_tree ../images
//= link_tree ../../javascript .js

directories listed above with paths below

app/assets/images app/javascript/ app/assets/builds

Skulli commented 1 year ago

Same error with upgrade to 1.2.0 on github/actions. We are using esbuild. How you solved it?

Rails 7.0.8, ruby 3.2.2

RailsCod3rFuture commented 1 year ago

my issue was failing to separate the prod/dev configs. The watcher was turned on & it stopped the asset pipeline from compiling the application.js. Not sure how your esbuild setup is configured...But make sure locally that the asset precompile system runs and all resources are dumped in the public folder.

Skulli commented 1 year ago

Thanks, but it was a different issue then. My issue got fixed with 1.2.1