"Expected to find a manifest file"...but I don't have any asset
coorasse opened this issue · 11 comments
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.
How is your engine using sprockets? Without a manifest the engine should not be working with sprockets 4.
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
?
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.
(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.
-
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. -
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.
I think a configuration to disable this check would be sufficient.
- 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!
@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
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.
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.
Still no way to disable this?
https://github.com/sferik/rails_admin
apparently it doesn't have one. does this mean the engine should lock onto
sprockets < 4
or add amanifest.js
?
This fixed my issue. For an API only heroku app I removed all my assets and
- added
gem "sprockets", "<4"
- ran
bundle update sprockets
- Able to deploy to heroku