[RUBY] Countermeasures against "Webpacker :: Manifest :: MissingEntryError"

Introduction

Rails "Webpacker :: Manifest :: MissingEntryError" error countermeasures I will post it as a memorandum.

Development environment

・ Cloud9 ・ Rails 6.1.0

error contents

ruby: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>

When I started the server with "rails s" above, "** Webpacker :: Manifest :: MissingEntryError **" I got an error. According to various investigations, it seems that the following code is not required when using webpacker.

ruby:application.html.erb


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

** javascript_include_tag ** is read via Sprockets, so When using webpacker, you need to use the following ** "javascript_pack_tag" **.

ruby:application.html.erb


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

However, changing to the above does not solve the error, and I am currently using the above code by deleting it. Probably there is a problem with how to write javascript_pack_tag, so focus on that and find a solution I hope I can find it.

Recommended Posts

Countermeasures against "Webpacker :: Manifest :: MissingEntryError"
Webpacker :: Manifest :: MissingEntryError
[Solution] Rails6 Webpacker :: Manifest :: MissingEntryError
[Solution] Webpacker :: Manifest :: MissingEntryError in Rails