Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Rails 4.1.10 #216

Open
boxofrad opened this issue Mar 20, 2015 · 4 comments
Open

Rails 4.1.10 #216

boxofrad opened this issue Mar 20, 2015 · 4 comments

Comments

@boxofrad
Copy link

I've recently tried to upgrade my app from rails 4.1.4 to 4.1.10, and am now getting the following error in development:

Asset filtered out and will not be served: add `Rails.application.config.assets.precompile += %w( portal.js )` to `config/initializers/assets.rb` and restart your server

This asset was intentionally left out of the precompile because it's in my requirejs.yml.

Thanks 💖

@carsomyr
Copy link
Collaborator

@boxofrad How is it declared in your requirejs.yml?

@RusDavies
Copy link

Hello.

I'm having some difficulties with requirejs-rails together with recent versions of rails 4, which may include the same issue as reported by @boxofrad above.

I've created a couple of github repos, to help demonstrate working and non-working examples.

First of all, I've taken the example given at https://github.com/fs/requirejs-rails-example (which works), and adapted it for rails 4.1.4, see https://github.com/RusDavies/rails_4.1.4 . That works just fine.

Then I've attempted to adapt the same code for rails 4.2.1, see https://github.com/RusDavies/rails_4.2.1 . In this case, there are a couple of issues:

  1. In config/environment.rb, I've had to require 'yaml', otherwise requirejs-rails fails with 'uninitialized constant Requirejs::Rails::Engine::YAML (NameError)'.
  2. In config/initializers/assets.rb, I've had to add the top-level require modules to the precompile list, otherwise I get the same 'Asset filtered out and will not be served..." error as reported by @boxofrad.

With these changes, it seems to work. However, point (2) seems to go against the requirejs-rails documentation (https://github.com/jwhitley/requirejs-rails#avoid-configassetsprecompile). Moreover, this was not necessary with rails 4.1.4.

So, am I doing something wrong? Or is there some incompatibility with recent versions of Rails ?

Thanks for your help :)

@boxofrad
Copy link
Author

Sorry for the late reply...

Here's my requirejs.yml

modules:
  - name: 'application'
  - name: 'portal'
  - name: 'admin'

@gtd
Copy link

gtd commented Jun 13, 2015

I've also had the same Asset filtered out and will not be served: error in an app I'm upgrading from 3.2 to 4.2. This was discussed in the sprockets repo at rails/sprockets-rails#156.

So far I've worked around this the same as @RusDavies, but of course I don't like having to maintain that parallel manifest just for development purposes.

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

No branches or pull requests

4 participants