Comments (23)
I'm running still running into this problem, I upgraded Rails to 4.2.6 which depends on sprockets (>= 3.0.0). Is there a way to hotfix this so I can deploy my security updates?
from requirejs-rails.
Thanks all for the reports. I'm looking to have a fix out in the upcoming week.
from requirejs-rails.
@samstarling I had a similar issue some time back, try downgrading your version of sprocket-rails
to 2.x
, that fixed it for me
from requirejs-rails.
@IceDragon200 You're right - downgrading sprockets-rails
to 2.3.3 fixed this.
from requirejs-rails.
This seems to be the issue. rails/sprockets-rails#237
from requirejs-rails.
I have the same issue... Hope this can get fixed!
from requirejs-rails.
When I try to downgrade sprockets-rails
to 2.3.3
I run into these kinds of errors:
Bundler could not find compatible versions for gem "tilt":
In snapshot (Gemfile.lock):
tilt (= 2.0.1)
In Gemfile:
haml was resolved to 4.0.7, which depends on
tilt
sass-rails (~> 5.0) was resolved to 5.0.4, which depends on
tilt (< 3, >= 1.1)
delayed_job_web was resolved to 1.2.10, which depends on
sinatra (>= 1.4.4) was resolved to 1.4.6, which depends on
tilt (< 3, >= 1.3)
sprockets (= 2.3.3) was resolved to 2.3.3, which depends on
tilt (!= 1.3.0, ~> 1.1)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
I tried downgrading a lot of gems, but bundler can't seem to solve the dependency issues. @carsomyr are you working on a fix? I would love to help!
from requirejs-rails.
All, I've been very busy lately delivering a major feature. I'll try to look into this on Saturday.
from requirejs-rails.
No problem @carsomyr, if you need a hand let me know. For now I removed this Gem and switched to using plain require-js
, so the urgency is gone for me.
from requirejs-rails.
You can replace Raiils.application.assets
with Rails.application.assets_manifest.files.values.map{|v| v['logical_path']}
(ref. https://github.com/rails/sprockets-rails/blob/6f5a37cfc7e5e71e2a7e1d1c002448dc374f1324/lib/sprockets/railtie.rb#L142-L148)
from requirejs-rails.
@matfiz thanks for the comment. But what do you mean? Where should I replace this?
from requirejs-rails.
I got this result for the manifest files:
>> Rails.application.assets_manifest.files
=> {}
from requirejs-rails.
@jankeesvw have you checked in production env?
from requirejs-rails.
@matfiz no only in development mode, how do you overwrite this? Add something to an initializer?
from requirejs-rails.
The assets_manifest reads the Sprockets manifest file from compiled assets - these are available only in production. AFAIK you can emulate it in development by setting config.assets.compile = false
in development.rb
.
from requirejs-rails.
Thanks for the quick response @matfiz, can you give me an concrete example of how we can fix this error?
from requirejs-rails.
Hi @matfiz, would be great if you have some more information on your proposed solution! Thanks!
from requirejs-rails.
I've just run into this issue as well. Is there any update on suggested resolutions?
from requirejs-rails.
Is there someone with a solution / work around?
from requirejs-rails.
@jankeesvw I switched my app to using modulejs
instead of requirejs
, following this pattern:
https://reinteractive.net/posts/172-a-better-way-to-modularise-your-js-in-rails
It has been working well for me, and fits more comfortably into the asset pipeline.
from requirejs-rails.
@ijdickinson that looks good! Did it require a lot of rewriting?
I would rather not rewrite the app, there is quite some JavaScript in my application.
from requirejs-rails.
@jankeesvw No, it was very straightforward. The signature for the modulejs require
function is almost the same as the requirejs require
, and then you need to rely on the asset pipeline to load the JavaScript manifest in the usual way - modulejs doesn't do any file management like requirejs does. Modulejs isn't nearly as capable as requirejs, so if you're relying on aliasing and those kinds of advanced features it won't help you.
We probably shouldn't continue this discussion in this issue thread - it's going a bit off-topic. Please feel free to pm me if you want more details!
from requirejs-rails.
For me this appeared to be a problem with a sprockets upgrade. We needed to upgrade to sprockets 3 and there were multiple errors related to asset precompile.
The cause of the actual error is essentially that it's trying to access:
Rails.application.assets.paths.dup
Unfortunately in sprockets along the way this no longer works. Instead of accessing application.assets.path, the valid location now appears to be application.config.assets.
Although this was able to get us further, there are many more sprockets problems. I'll see if I can clean things up a bit and test my changes against sprockets 2, but my company is now using:
https://github.com/MediaFactual/requirejs-rails/tree/rails5-1-0-0
or with bundler:
gem 'requirejs-rails', :git => 'https://github.com/MediaFactual/requirejs-rails.git', :branch => 'rails5-1-0-0'
If these changes appear to be stable on our systems, I'll submit a pull request.
from requirejs-rails.
Related Issues (20)
- Precompiled asset doesn't generate new digest filename
- Precompiling process is considered slow HOT 7
- uninitialized constant Sprockets::DigestUtils in 0.9.9 HOT 16
- Non-digested files are not created in public/assets
- "rake assets:precompile" raise error at new rails project HOT 10
- undefined method requirejs_include_tag HOT 1
- Almond build broken
- Missing local paths config in development
- Updating to 4.2.5.1 breaks app HOT 1
- sprockets-rails >= 3 throws "Asset was not declared to be precompiled in production" HOT 2
- error : = requirejs_include_tag "application HOT 1
- Error raised on requirejs_include_tags
- RequireJS concatenating JS but not minifying HOT 2
- Precompile doesn't appear to work on Sprockets 3 (Rails 5) HOT 1
- coffeescript compiled every time when request
- css files included with !text are getting stripped from /src/ HOT 2
- requirejs-rails isn't working with rails >= 5.1 because erubis has been replaced with erubi HOT 4
- Multiple Errors when requiring files
- Error: TypeError: content.replace is not a function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from requirejs-rails.