Skip to content

Commit

Permalink
rails-ujsとjQueryの読み込みを修正 (#1896)
Browse files Browse the repository at this point in the history
* remove javascript_pack_tag and load jQuery from jquery gem

* remove rails-ujs from app/javascript/packs/application.js
  • Loading branch information
nabeta authored Aug 17, 2024
1 parent ad5dd9b commit 296aa66
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 35 deletions.
2 changes: 2 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require rails-ujs
//= require jquery2
//= require enju_leaf
9 changes: 0 additions & 9 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,4 @@

//console.log('Hello World from Webpacker')

import Rails from "@rails/ujs"
import * as ActiveStorage from "@rails/activestorage"
import "channels"
import "jquery"
import $ from 'jquery'
global.$ = $
global.jQuery = $

Rails.start()
ActiveStorage.start()
2 changes: 1 addition & 1 deletion app/views/page/_include.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= stylesheet_link_tag 'application' %>
<%= stylesheet_link_tag 'print', media: :print %>
<%= javascript_pack_tag 'application' %>
<%= javascript_include_tag 'application' %>
<%= javascript_pack_tag 'application' %>
<%= csrf_meta_tag %>

<style>
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
"@babel/runtime": "^7.25.0",
"@mui/system": "^5.16.7",
"@rails/actioncable": "~7.1.3",
"@rails/activestorage": "~7.1.3",
"@rails/ujs": "~7.1.3",
"@rails/webpacker": "5.4.4",
"dnd-core": "^16.0.1",
"jquery": "^2.2.4",
"mirador": "^4.0.0-alpha.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
22 changes: 0 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1322,18 +1322,6 @@
resolved "https://registry.yarnpkg.com/@rails/actioncable/-/actioncable-7.1.3.tgz#4db480347775aeecd4dde2405659eef74a458881"
integrity sha512-ojNvnoZtPN0pYvVFtlO7dyEN9Oml1B6IDM+whGKVak69MMYW99lC2NOWXWeE3bmwEydbP/nn6ERcpfjHVjYQjA==

"@rails/activestorage@~7.1.3":
version "7.1.3"
resolved "https://registry.yarnpkg.com/@rails/activestorage/-/activestorage-7.1.3.tgz#e83ece6c5fd94b3ddf30a8cf3b8f78cad049e596"
integrity sha512-B+RFYAU8vdTPFg0IJcRp2ey0Qw9hpcUOqHHcWqftDJ76ZMBi9+m/UUeMJlNsSd0l9eD+1HLlFSo1X//cY4yiDw==
dependencies:
spark-md5 "^3.0.1"

"@rails/ujs@~7.1.3":
version "7.1.3"
resolved "https://registry.yarnpkg.com/@rails/ujs/-/ujs-7.1.3.tgz#6d94a68b7da5046147d31716e0c187a4ead4fb93"
integrity sha512-FxtgKNvvIonoBE1TK7U10VMf6CYvzq8SIZ1XZ1Q8zcn/BEXzPzid3zC9qFiojuI5WXVwWhO8GFqApq0stD+OqQ==

"@rails/webpacker@5.4.4":
version "5.4.4"
resolved "https://registry.yarnpkg.com/@rails/webpacker/-/webpacker-5.4.4.tgz#971a41b987c096c908ce4088accd57c1a9a7e2f7"
Expand Down Expand Up @@ -4698,11 +4686,6 @@ jest-worker@^26.5.0:
merge-stream "^2.0.0"
supports-color "^7.0.0"

jquery@^2.2.4:
version "2.2.4"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-2.2.4.tgz#2c89d6889b5eac522a7eea32c14521559c6cbf02"
integrity sha512-lBHj60ezci2u1v2FqnZIraShGgEXq35qCzMv4lITyHGppTnA13rwR0MgwyNJh9TnDs3aXUvd1xjAotfraMHX/Q==

"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
Expand Down Expand Up @@ -7427,11 +7410,6 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==

spark-md5@^3.0.1:
version "3.0.2"
resolved "https://registry.yarnpkg.com/spark-md5/-/spark-md5-3.0.2.tgz#7952c4a30784347abcee73268e473b9c0167e3fc"
integrity sha512-wcFzz9cDfbuqe0FZzfi2or1sgyIrsDwmPwfZC4hiNidPdPINjeUwNfv5kldczoEAcjl9Y1L3SM7Uz2PUEQzxQw==

spdy-transport@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/spdy-transport/-/spdy-transport-3.0.0.tgz#00d4863a6400ad75df93361a1608605e5dcdcf31"
Expand Down

0 comments on commit 296aa66

Please sign in to comment.