1
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 3 years have passed since last update.

「Webpacker::Manifest::MissingEntryError」対策

Last updated at Posted at 2020-12-29

#はじめに
Rails 「Webpacker::Manifest::MissingEntryError」エラーの対策について、
備忘録として投稿します。

#開発環境
・cloud9
・Rails 6.1.0

#エラー内容

application.html.erb
<!DOCTYPE html>
<html>
  <head>
    <title>Myapp</title>
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>
    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  </head>
  <body>
    <%= yield %>
  </body>
</html>

上記で「rails s」でサーバーを立ち上げた際に、「Webpacker::Manifest::MissingEntryError
エラーが出た。
色々調べると、webpackerを使う際は下記コードが要らないらしい。

application.html.erb
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>

javascript_include_tagはSprockets経由で読み取るので、
webpackerを使う際は下記の**「javascript_pack_tag」**を使う必要がある。

application.html.erb
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>

ただ、上記に変更してもエラーは解消せず、現在は上記コードを削除して使用しています。
恐らくjavascript_pack_tagの書き方に問題があるので、そこを重点的に調べて解決策を
見出せればと思います。

1
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
1
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?