Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Expected to find a manifest file"...but I don't have any asset #448

Open
coorasse opened this issue Oct 16, 2019 · 11 comments
Open

"Expected to find a manifest file"...but I don't have any asset #448

coorasse opened this issue Oct 16, 2019 · 11 comments

Comments

@coorasse
Copy link

coorasse commented Oct 16, 2019

This error is raised when the manifest file is not present. See also #444 .
Our use case is different: our app doesn't contain any sprockets assets, and uses webpacker to manage everything, but an engine that is mounted needs Sprockets. So basically:

  • I don't want to create a manifest.js. I don't need it. I don't have any resource.
  • I cannot disable sprockets. Is needed by the engine
  • My only solution is to rollback sprockets to < 4.

Proposed solution: remove this check.
I am willing to hear alternative solution and/or open a PR to fix this.

@coorasse coorasse changed the title "Expected to find a manifest file" but I don't have any asset "Expected to find a manifest file"...but I don't have any asset Oct 16, 2019
@rafaelfranca
Copy link
Member

How is your engine using sprockets? Without a manifest the engine should not be working with sprockets 4.

@coorasse
Copy link
Author

https://github.com/sferik/rails_admin

apparently it doesn't have one. does this mean the engine should lock onto sprockets < 4 or add a manifest.js ?

@rafaelfranca
Copy link
Member

rafaelfranca commented Oct 18, 2019

It seems Rails admin is configuring sprcokets using the precompile list, so it should work if your application don't have a manifest https://github.com/sferik/rails_admin/blob/master/lib/rails_admin/engine.rb#L17.

I'm torn about removing this check. If we remove, people upgrading to sprockets 4 will silently have their apps not compiling the assets they were expecting, but in case like yours, you really don't need a manifest.

I wonder if it would be sufficient if we had a configuration to disable this check.

@jonathanhefner
Copy link
Member

(Preface: I use Sprockets in all of my Rails apps, and I greatly appreciate all the work that has gone into it.)

I recently encountered two use cases for disabling this check.

  1. Adding an extremely minimal dummy Rails app to a gem test suite. For example, adding the following:

    ## test/test_helper.rb
    
    require 'rails/all'
    
    module Dummy
      class Application < Rails::Application
        config.root = File.join(__dir__, "dummy")
        config.load_defaults Rails::VERSION::STRING.to_f
        config.eager_load = false
      end
    end
    
    Rails.application.initialize!

    With Sprockets 4, requires a test/dummy/app/assets/config/manifest.js file.

  2. Testing a generator that calls out to other generators. When a generator invokes another generator, Rails requires certain files to already exist in #{destination}/bin and #{destination}/config. With Sprockets 4, a #{destination}/app/assets/config/manifest.js file is also required.

@coorasse
Copy link
Author

coorasse commented Oct 21, 2019

I think a configuration to disable this check would be sufficient.

@rafaelfranca
Copy link
Member

  1. Adding an extremely minimal dummy Rails app to a gem test suite. For example, adding the following:

That is not an minimal dummy Rails app. This is and would not have that problem

## test/test_helper.rb

require "rails"
require "active_model/railtie"
require "active_job/railtie"
require "action_controller/railtie"
require "action_view/railtie"

module Dummy
  class Application < Rails::Application
    config.root = File.join(__dir__, "dummy")
    config.load_defaults Rails::VERSION::STRING.to_f
    config.eager_load = false
  end
end

Rails.application.initialize!

@denys-husiev
Copy link

@rafaelfranca are you going to add configuration to disable this check? If yes, could you please provide an issue number so I can follow when it's done.

Thanks in advance

@mjankowski
Copy link

That is not an minimal dummy Rails app. This is and would not have that problem.

Thanks for this suggestion! I had a similar problem (spec suite in gem which should not have a manifest.js file, but does set up a dummy rails app). Changing away from the full rails/all to just including the piece s I needed solved this for me.

I think a config option might still make sense, but until then, this might help gem authors with dummy apps sort it out.

@kennyadsl
Copy link

I think #446 would fix this issue, since it allows to specify a custom path for the Dummy app manifest, as we would do in Solidus if it gets merged.

@estiens
Copy link

estiens commented Oct 14, 2020

Still no way to disable this?

@jmoon90
Copy link

jmoon90 commented Jun 14, 2021

https://github.com/sferik/rails_admin

apparently it doesn't have one. does this mean the engine should lock onto sprockets < 4 or add a manifest.js ?

This fixed my issue. For an API only heroku app I removed all my assets and

  1. added gem "sprockets", "<4"
  2. ran bundle update sprockets
  3. Able to deploy to heroku

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants