0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ようやくJQueryも発火できた。

Posted at

かれこれ何日も悩んでたJQueryの発火に成功した。

解決方法は以下の通り。

1 まずはyarn add jquery

そしてwebpackのenvironment.jsを編集して、node_modulesのjquery/src/jqueryを読みこませる。

2 次にapplication.jsにimport文を書いて読み込ませたいjqueryのファイルを指定。

この時app/javascript/jquery/src/jquery.jsに指定し、jquery.jsにimportを書くことでフォルダ内の他のjqueryも読み込めるようにする。

ようやく動いた。しかし、もし今後つまずいたら?

何処で止まってしまっているのかを把握することが大事だと気付いた。今回の場合はapplication.jsにjquery文を書いたら動いていたので、webpackでのjquery追加はできているしenvironment.jsも問題ないと思った。

一つ一つ段階的に建設的に。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?