Questions tagged [jsbundling-rails]

20 questions
4
votes
1 answer

How to import JS files with esbuild & jsbundling-rails

I'm moving a Rails 6 app from webpack & webpacker to esbuild & jsbundling-rails I can't find any documentation on the correct way to import custom js files in application.js, if not using stimulus. Thanks.
Pseudo-Hippy
  • 177
  • 11
4
votes
1 answer

Reduce Javascript size in Rails app and improve performance score. Maybe issue with ESBuild?

Not specifically a Rails question, but a question within a Rails app. In my app I am using the jsbundling-rails gem configured with esbuild. This gem adds a build line to my package.json file. It works and compiles all my JS and runs fine. …
rctneil
  • 7,016
  • 10
  • 40
  • 83
4
votes
0 answers

Using webpack with js_bundling and rails 7

I'm currently building an application using new rails 7 and js_bundling gem with webpack (not webpacker). But I'm having trouble making the javascript work. I am currently packing all my sources into assets/builds/application.js with webpack which…
3
votes
0 answers

In Rails 7 with esbuild build, how do I run a script of esbuild fails?

I have this script that runs when running Rails 7 with esbuild build, this is inside package.json in the scripts attribute, it's ran from the Rails procfile: esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds however I often…
3
votes
0 answers

Setting up a Rails app with a react front end

I'm trying to set up a Rails app with a react front end, as indicated in this post: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-ruby-on-rails-project-with-a-react-frontend However, webpacker is now retired:…
2
votes
1 answer

bin/dev: 8: exec: foreman: not found

Hello I am currently following a tutorial in order to connect react to my rails app that uses https://github.com/rails/jsbundling-rails and went with esbuild, however when I run bin/dev in my terminal I get the above error any help is appreciated as…
CoolGuy
  • 99
  • 7
2
votes
1 answer

No route matches [GET] "/assets/application.js & No route matches [GET] "/assets/application.css

I am moving away from Webpack to Esbuild, using jsbundling-rails and cssbundling-rails. Rails version is 6.1.5 Everything seems to be working fine, but in my logs I get: ActionController::RoutingError (No route matches [GET]…
Pseudo-Hippy
  • 177
  • 11
1
vote
1 answer

Upgrade Rails 6.1 > 7.0, add turbo-rails and importmap, gems do not install

I'm trying to upgrade a working legacy app to Rails 7, from Rails 6.1. I want to use Hotwire, so I added gem turbo-rails. Ruby 3.1.2 zeitwerk no webpacker sprockets-rails no modern JS yet app passes tests server boots locally Added gem…
1
vote
1 answer

javascript_include_tag behavior after remove sprocket in rails 7

I started a fresh rails 7 application using jsbundling-rails (with esbuild) and cssbundling-rails (with bootstrap). The pipeline works well to build assets. After testing that, I removed sprockets gem and configs from application (basically, I…
1
vote
1 answer

Image imported from Javascript file does not have fingerprint from asset precompile (Rails 6, esbuild, and jsbundling)

I am trying to import an image from JS in production. I have rails 6 with esbuild and jsbundling, and it works fine in development environment, but in production, images being imported from JS has no fingerprint. I've seen a Stack Overflow post like…
yangtheman
  • 509
  • 4
  • 21
1
vote
0 answers

How can I resolve "Error: Can't find stylesheet to import." for the uswds source styles (Ver 3.3.0)?

I'm using Rails 6.1.7 with jsbundling-rails and cssbundling-rails. I'm bundling with Webpack and Dart sass for js and css respectively. I've tried to follow the docs, and added the sass load paths as follows in my webpack.config.js: module: { …
1
vote
1 answer

Getting going with jsbundling-rails

Trying to grok how to work with js files in Rails 7 using the jsbundling-rails gem and ES modules... In short, I want to code up functions and have them available in the page. Here's a simple example. Working with…
painbot
  • 160
  • 9
0
votes
2 answers

Enable Bootstrap Tooltips in Rails 7

I am switching my Rails 7 application (which currently uses Sprockets) to using the new jsbundling+esbuild approach. I cannot get Bootstrap's tooltip functionality to work, even though I think I am following the exact instructions. This is the…
Jaco Pretorius
  • 24,380
  • 11
  • 62
  • 94
0
votes
1 answer

Forced to run assets:precompile two times to get the webpack builds copied to public directory

after long list of issues with rails/webpack there is a last one that hard to understand to fix properly. I use: rails with jsbundling-rails and sprockets-rails webpack yarn (switched from npm because the command assets:precompile forced me) When…
romain-p
  • 3
  • 2
0
votes
1 answer

Bundling directory structures in esbuild for a Rails 7 application

How do I import Javascript with directories? I've set up jsbundling-rails using the esbuild bundler for a Rails 7 project that was previously using sprockets to handle all assets. It appears that I've set it up correctly, because I can load JS…
Thomas
  • 2,622
  • 1
  • 9
  • 16
1
2