webpacker

Deploy rails react app with webpacker gem on AWS elastic beanstalk

谁说胖子不能爱 提交于 2020-06-10 03:51:55
问题 I'm trying to deploy a rails 5.1 & react app created with webpacker gem using AWS Elastic Beanstalk. The problem is I keep getting the following error: Webpacker requires Node.js >= 6.0.0 and you are using 4.6.0 I'm using Node 9.5.0 on my computer. Any suggestions?? 回答1: To install nodejs using yum (assuming you're using the default Amazon Linux) https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo

How to execute custom javascript functions in Rails 6

旧街凉风 提交于 2020-05-29 04:24:07
问题 With the arrival of Webpacker to Ruby On Rails I can't find a way to use my Javascript functions. I have a file called app-globals.js with a function to test: function alerts () { alert ("TEST") } Then I want to use it in one of my views: <% = button_tag 'Button', type: 'button', onClick: 'alerts ()'%> But when I press the button, this error is shown in the browser console: ReferenceError: alerts is not defined I placed the app-globals.js file in "app / javascript" and in "app / javascript /

How to use React within Rails using coffee?

 ̄綄美尐妖づ 提交于 2020-05-16 03:13:31
问题 I'm adding Reactjs on a Rails application (5.2), but I want to use coffeescript to write it. I've added webpack and installed react and coffee support, and both seems to work, but when I want to use both I get: Module parse failed: Unexpected token (10:9) File was processed with these loaders: * ./node_modules/coffee-loader/index.js You may need an additional loader to handle the result of these loaders. | | Foo = props(() => { > return <div>Hello {props.name}!</div>; | }); | I also updated

How to add jquery third party plugin in rails 6 webpacker

有些话、适合烂在心里 提交于 2020-04-28 08:30:33
问题 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") //.start() require("turbolinks").start() require("@rails/activestorage").start() require('jquery').start() require('jquery_ujs').start() require('bootstrap-daterangepicker').start() require("custom/custom").start() require("bootstrap").start() require("channels") i am able to add custom/custom but bootstrap and

Rails 6 and Tailwind CSS does not deploy to Heroku

不羁岁月 提交于 2020-04-13 17:09:26
问题 I have a Rails 6 app that was successfully deployed to Heroku and worked on localhost:3000. I added tailwindcss via yarn and webpack. It runs perfectly fine on localhost, but does not run on heroku. When I run heroku logs I get the following error I've read all the Heroku Rails 6 Webpacker issues, and tried all the suggestions. Nothing worked. I have commented out <%= stylesheet_pack_tag %> ... didn't help I have toggled extract_css: true in webpacker.yml file .... didn't help I have run

Rails 6 and Tailwind CSS does not deploy to Heroku

爱⌒轻易说出口 提交于 2020-04-13 17:09:21
问题 I have a Rails 6 app that was successfully deployed to Heroku and worked on localhost:3000. I added tailwindcss via yarn and webpack. It runs perfectly fine on localhost, but does not run on heroku. When I run heroku logs I get the following error I've read all the Heroku Rails 6 Webpacker issues, and tried all the suggestions. Nothing worked. I have commented out <%= stylesheet_pack_tag %> ... didn't help I have toggled extract_css: true in webpacker.yml file .... didn't help I have run

Rails Leaflet Webpack blank page

情到浓时终转凉″ 提交于 2020-03-23 08:08:10
问题 This a continuation of a related problem that @rossta fixed part of, but now the problem is moved so thought I'd start over. No errors and the script is completing (verified by console.log outputs in the script). The body element shows up. This worked with gem leaflet and now webpack in Rails 5.2, but not now in Rails 6 with webpack I moved the script into the page to isolate the problem map/index.html.erb <p id="notice"><%= notice %></p> <% provide(:title, 'Map') %> <h4>This is map/index

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

南楼画角 提交于 2020-02-25 07:20:24
问题 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 turbo link details for javascript pack tag. Removed javascript include tag (not sure if this helps or not) Ensure I'm on the latest webpacker 4.2 ran rake assets:clean && rake assets:precompile manually on heroku just to ensure things are getting

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

别说谁变了你拦得住时间么 提交于 2020-02-25 07:18:45
问题 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 turbo link details for javascript pack tag. Removed javascript include tag (not sure if this helps or not) Ensure I'm on the latest webpacker 4.2 ran rake assets:clean && rake assets:precompile manually on heroku just to ensure things are getting

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

浪尽此生 提交于 2020-02-03 09:22:27
问题 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 is: create an app_directory in /app/javascript copied my development javascript file into the app_directory and renamed it to index.js added console.log('Hello World from Webpacker'); to index.js added import "app_directory"; to /app/javascript/packs