1
Uncaught TypeError: Failed to resolve module specifier "application". Relative references must start with either "/", "./", or "../".

In rails 7 while creating an engine. It is unable to load the javascript. Also tried to load the assets in assets.rb:

Rails.application.config.assets.precompile += %w( application.js )

In engine.rb loaded importmap:

app.config.importmap.paths << root.join("config/importmap.rb")
1
  • are you trying to load application.js from the main app or is that file in your engine?
    – Alex
    Commented Jul 4 at 12:10

0