Questions tagged [webpacker]

Webpacker is a Ruby gem for Ruby on Rails that makes it easy to use Webpack, the JavaScript module bundler, to manage application-like JavaScript in Rails. It coexists with the asset pipeline and can even replace it by processing CSS, images, fonts, and more.

Features

License

MIT

Links

GitHub

RubyGems

817 questions
103
votes
12 answers

How to import and use image in a Vue single file component?

I think this should be simple, but I am facing some trouble on how to import and use an image in Vue single file component. Can someone help me how to do this? Here is my code snippet:
aks
  • 8,796
  • 11
  • 50
  • 78
41
votes
5 answers

Using Rails-UJS in JS modules (Rails 6 with webpacker)

i just switched to Rails 6 (6.0.0.rc1) which uses the Webpacker gem by default for Javascript assets together with Rails-UJS. I want to use Rails UJS in some of my modules in order to submit forms from a function with: const form =…
R4ttlesnake
  • 1,661
  • 3
  • 18
  • 28
36
votes
1 answer

Slow sass-loader Build Times with Webpack

Summary When we switched to using Webpack for handling our SASS files, we noticed that our build times in some cases became really slow. After measuring the performance of different parts of the build using the SpeedMeasurePlugin, it seems that…
mc92
  • 475
  • 5
  • 10
28
votes
5 answers

Using Rails 6, where do you put your “page specific” JavaScript code?

My question here is the same as Using Rails 3.1, where do you put your "page specific" JavaScript code?, just for Rails 6 instead of Rails 3.1. Suppose I have some JavaScript that I want to use for my posts index page. Where do I put that file, and…
Adam Zerner
  • 17,797
  • 15
  • 90
  • 156
26
votes
5 answers

How to handle images in a Rails / Webpacker / React app?

I am using Webpacker with rails 5.1.4 to play with React, Redux, and react-router-dom. I have a Navbar.jsx component in app/javascript/src/components/ that needs to display an image, but I am not able to access my images stored in…
adesurirey
  • 2,549
  • 2
  • 16
  • 36
25
votes
2 answers

What is the correct way to pass parameters to a React-query useQuery method that uses Axios

I am currently building a Ruby on Rails Webpacker application with a React front end. I am at the point where I would like to create all the quires I need to make calls to my Rails API. I was loosely following this tutorial…
humbledev7000
  • 275
  • 1
  • 4
  • 8
25
votes
9 answers

stylesheet_pack_tag not finding app/javascript/src/application.css in rails 5.1 with webpacker gem

I am receiving this error when I try to load a page in my new rails 5.1 app using webpacker. I would like webpacker to handle CSS as well. Started GET "/" for ::1 at 2017-09-01 12:20:23 -0400 Processing by HomeController#welcome as HTML Rendering…
wuliwong
  • 4,238
  • 9
  • 41
  • 69
24
votes
6 answers

Rails: Webpacker 4.2 can't find application in /app/public/packs/manifest.json heroku

I'm a bit stumped. My local rails app works great with webpacker 4.2 and react, but when deploying to production gives me the wonderful can't find application in /app/public/packs/manifest.json error. Here's what I've tried: Tried adding/removing…
Justin
  • 2,940
  • 3
  • 25
  • 43
24
votes
12 answers

Rails: Webpacker::Manifest::MissingEntryError in Home#index

Webpacker::Manifest::MissingEntryError in Home#index Showing /Users/khalidhosein/Desktop/myEPKmedia/builder/khalid101/app/views/layouts/embedded_app.html.erb where line #7 raised: Webpacker can't find hello_react.js in…
Khalid
  • 259
  • 1
  • 2
  • 7
23
votes
5 answers

Rails Webpacker compile error on Production enviorment

env Rails 6.0.0 Ruby 2.6.0 Amazon Linux2 What When I deploy my rails app this error happen ActionView::Template::Error (Webpacker can't find application in /home/web/www/eloop-regular/public/packs/manifest.json. Possible causes: 1. You want to set…
阿吽no呼吸
  • 231
  • 1
  • 2
  • 3
23
votes
3 answers

Webpacker in Rails 5 takes a long time to compile not that many files. How can I see what it's doing?

[Webpacker] Compiling… It takes several seconds (6.2 seconds) to compile any of my changes to javascript files. It's really slowing my JS development down. Is there any way to see what Webpacker in Rails is doing and which files it's spending most…
cmrichards
  • 1,725
  • 1
  • 19
  • 28
20
votes
5 answers

How to add jquery third party plugin in rails 6 webpacker

I know its simple but with update of rails 6. there is new syntax in rails 6 for manage javascript assets which is maintained by webpacker. //application.js require("@rails/ujs")…
uzaif
  • 3,511
  • 2
  • 21
  • 33
19
votes
2 answers

When to use stylesheet_pack_tag instead stylesheet_link_tag with Rails 6

When creating a new rails project with Rails 6, it creates an application.html.erb with stylesheet_link_tag to load CSS and javascript_pack_tag for javascript files. Now, rails 6 also provide a stylesheet_pack_tag, so my question is, when to use it?…
Sanjay Prajapati
  • 789
  • 1
  • 8
  • 17
18
votes
4 answers

Rails 5/6: How to include JS functions with webpacker?

I am trying to update a Rails 3 app to Rails 6 and I have problems with the now default webpacker since my Javascript functions are not accessible. I get: ReferenceError: Can't find variable: functionName for all js function triggers. What I did…
SEJU
  • 995
  • 1
  • 9
  • 28
16
votes
6 answers

Using Bootstrap Icons in Rails 6 with Webpacker

I wanted to use Bootstrap icons in beta "Official open source SVG icon library for Bootstrap." https://icons.getbootstrap.com/. This is for Bootstrap 4 in Rails 6. I tried various imports and includes in application.js and application.scss with no…
Greg
  • 2,359
  • 5
  • 22
  • 35
1
2 3
54 55