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
16
votes
1 answer

Rails 6 webpacker cannot find module for installed module

in my Rails 6 project, i added jQuery pushMenu with yarn add push-menu from https://www.npmjs.com/package/push-menu Now i can see this in node-modules folder, as push-menu. however, when i try to import or include from packs,…
Umes Bastola
  • 527
  • 2
  • 6
  • 18
16
votes
2 answers

Rails + webpacker + vue: "You are using the runtime-only build of Vue where the template compiler is not available."

I've created a new rails 5.2 application and installed vue with: bundle exec rails webpacker:install:vue After creating a simple endpoint Home#landing and adding <%= javascript_pack_tag 'hello_vue' %> to the default layout the sample app is working…
pragmatic_programmer
  • 3,566
  • 3
  • 29
  • 36
16
votes
3 answers

Rails 5.1 webpacker "import" a .js.erb file?

From app/javascript/packs/application.js I'm trying to import "../foo" where the file is foo.js.erb. Webpacker and yarn are working great for other imports in application.js, for example import "../bar" when that file is bar.js but if I try with a…
eagspoo
  • 2,095
  • 3
  • 22
  • 31
15
votes
4 answers

How to use cocoon gem in Rails 6

Have been using cocoon gem for nested forms in rails 4 & rails 5 apps. Currently, I was updating one of the rails 5.2 app (which is using cocoon gem) to rails 6. As rails 6 is using webpacker, so I tired to require cocoon javascript in…
Sikandar Tariq
  • 1,296
  • 1
  • 13
  • 29
15
votes
4 answers

how to use js files from Gem in rails 6 application

So I have been using rails for quite a while. But with Rails 6 I have been really struggling to get moving. I have some custom gems I use for assets and things and I cannot figure out how to load the js files. What I am used to application.js //=…
Rockwell Rice
  • 3,376
  • 5
  • 33
  • 61
15
votes
2 answers

How to add multiple source_path in Rails Webpacker

We are using Webpacker for loading JavaScripts and CSS files into the webpage. Currently, in webpacker.yml we have set the source_path to app/javascript. Which is working fine to load the JavaScript files form this directory. But in our application,…
Dipak
  • 6,532
  • 8
  • 63
  • 87
15
votes
1 answer

Using webpacker (webpack-dev-server) to compile inside a docker container without rebuilding

Edit: Docker version 17.12.0-ce, build c97c6d6 On OSX High Sierra 10.12.6 I'm in the process of including webpacker into an existing rails 4.2 project (some parts still use sprockets) and have been running into some issues with hot reloading. My…
MattLock
  • 174
  • 3
  • 17
15
votes
1 answer

What is the best way to use webpacker in a Rails engine?

I realise there is some debate about using webpacker in Rails engines but I have a simple usecase and currently have a workaround. Would like to know of a better (the best?) solution. In this rails engine I have webpacker setup in the "spec/dummy"…
PropertyWebBuilder
  • 1,286
  • 2
  • 12
  • 18
15
votes
5 answers

How to access assets with webpacker gem

Could you explain me how to access assets from webpacker gem within vue.js components? For example - how to create div with background image. I've tried use /app/assets/images and /app/javascripts/assets folders but images is only available in…
Alexey Poimtsev
  • 2,845
  • 3
  • 35
  • 63
14
votes
5 answers

Angular Dependency Injection - @Injectable() fails in test, while @Inject() works

Generic issue I have just started adding webpacker with angular 5 to the existing rails application. All is fine except for a weird issue with a DI in test. It seems my Angular components are just working when created with browser, but when being…
BroiSatse
  • 44,031
  • 8
  • 61
  • 86
13
votes
6 answers

Rails 6 server just stopped compiling webpack

I have a really weird thing happening. I was working on this project on my development environment and when I used to start the Rails server, It would compile webpack on the first browser request. Now, all the sudden, this is not happening,…
Dan
  • 351
  • 1
  • 3
  • 16
13
votes
3 answers

How to use jQuery with rails webpacker 3

I generate a new rails app : rails new titi --webpack=vue and would like to use jQuery (or other libs like popper, vue-resource...). I tried to yarn add jquerywhich was fine, but I don't have access to jQuery in my JavaScript code. In previous…
Kikan
  • 281
  • 1
  • 2
  • 8
12
votes
1 answer

Ruby on Rails 6 + Docker = Webpacker::Manifest::MissingEntryError?

Trying to run my Rails app as a Docker container but got the following error when opening a page: Webpacker can't find application in /app/public/packs/manifest.json. Possible causes: 1. You want to set webpacker.yml value of compile to true for…
12
votes
2 answers

ActionView::Template::Error: 785: unexpected token at ''

This error happens randomly during testing (standard Rails testing toolkit) after running rails test. Failed test can be any test in any file. This error happens usually in testing environment during CI/CD process. Locally it occurs very…
11
votes
2 answers

How to import stylesheets from node_modules in sass loader without "~"

I'm setting up my Storybook instance to load the styles from my Rails app but it failed to load the imports within my main.scss file, both are stylesheets from node_modules: @import 'react-table/react-table.css'; @import 'animate.css'; I received…
nayiaw
  • 1,416
  • 4
  • 17
  • 26
1
2
3
54 55