tricknotes / ember-cli-rails

Unify your EmberCLI and Rails Workflows
http://thoughtbot.github.io/ember-cli-rails/
MIT License
713 stars 205 forks source link

Sprockets 4.2.0: Generates 404 on all assets #605

Open james-em opened 1 year ago

james-em commented 1 year ago

Hi,

All my gems are up to date. My frontend packages on the other hand very outdated, however it doesn't matter in the matter of this issue.

The CLI command

bundle exec rake ember:compile

builds by default assets into tmp/ember-cli/apps/frontend/assets and there is some magic that makes

GET http://localhost:3000/assets/vendor.css

possible.

However, starting with Sprockets 4.2.0, these GET http://localhost:3000/assets/vendor.css makes 404.

Just though I would share in case somebody else hits the same bug.

factor4 commented 1 year ago

Hi! I solved this by not loading sprockets at all. In config/application.rb only load what you need and comment sprockets out:

require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
require "action_mailer/railtie"
# require "action_mailbox/engine"
# require "action_text/engine"
require "action_view/railtie"
# require "action_cable/engine"
# require "sprockets/railtie"
require "rails/test_unit/railtie"

You also have to comment out various config options which belongs to the assets pipeline under config/environments/* and config/initializers/assets.rb.

xtagon commented 11 months ago

Fixed in Sprockets 4.2.1