はじめに
本質的な理解ではなく、あくまで対処法にとどまります。
対処法
@rails/ujs
をyarn add -> install
問題
deviseを使って「ログアウト」を実装しようとしたところ、method: delete
を設定しているにも関わらず、get
リクエストでページ遷移してしまい、該当のrouteは存在しないと言われる
対処法
method: deleteはJSライブラリによって管理されているようです。
今回は、JSライブラリ@rails/ujs
を yarn add -> install で解決しました。
問題が解決しなかった理由
「rails立ち上げの際に esbuild を指定しているにも関わらず、importmap に関連した解決を試みたから」
本質的な理解ではありませんが、「esbuild」「webpacker」「importmap」が同じレベルのものらしいです。
よって、「importmap」と「esbuild」がコンフリクトを起こしてしまったのが問題を複雑にしていました。
rails 7 ではimportmapが標準、といった話を見た(勘違い?)のもこれに拍車をかけました。
おわりに
method: deleteはrailsの仕様なのだから、rails側で完結してくれよ・・・