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

Empty resolve_with config array results in non-functional pipeline #519

Open
kgreunke opened this issue May 9, 2023 · 0 comments
Open

Comments

@kgreunke
Copy link

kgreunke commented May 9, 2023

At first glance this might be an obvious statement, however if you happen to end up with a config that falls through the below setup routine and ends up with an empty array, nothing works and nothing tells you why it's not working.

      if config.assets.resolve_with.nil?
        config.assets.resolve_with = []
        config.assets.resolve_with << :manifest if config.assets.digest && !config.assets.debug
        config.assets.resolve_with << :environment if config.assets.compile
      end

https://github.com/rails/sprockets-rails/blob/73e7351abff3506f6dca6b2da8abedfd5c7c0d77/lib/sprockets/railtie.rb#LL226C1-L230C10

I managed to hit this problem where someone set the assets debug flag in the initializer. When running in production mode the :manifest option gets kicked out because of the debug flag and the :environment option gets kicked out because the default option in rails is to not compile assets in production.

If :manifest and :environment are the only two available options for resolvers, and neither are picked up, something should throw a warning at some point that the pipeline isn't going to resolve any assets.

For search purposes this was causing ActionView::Template::Error (The asset "application.css" is not present in the asset pipeline.) based on whatever was the first pipeline asset to be rendered

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

1 participant