Can't load ui-router-extras with Rails 4

226 views Asked by At

I'm using Rails 4.2.1, Bower, angular-rails-templates gem and ui-router-extras.

After installing ui-router-extras with bower and including it in my application.js with: require ct-ui-router-extras file I get the following error:

Sprockets::FileNotFound - couldn't find file 'ct-ui-router-extras'

After some playing around, I found that if I change the include to: require ui-router-extras I get the following error:

Sprockets::Rails::Helper::AssetAliasUsed - Asset was linked to from an alias rather than its exact path. Alias resolving may not be available in production.
15:01:07 web.1  | 

Use "ui-router-extras.js" instead of "ui-router-extras/release/ct-ui-router-extras.js"

This should alias correctly because the bower.json file for ui-router-extras maps to ct-ui-router-extras, but after some digging, I found this aliasing issue with sprockets.

Making this more complicated, angular-rails-templates isn't compatible with the latest version of sprockets. However, angular-rails-templates is compatible with sprockets 2.12.3, which, according to the sprockets issue above, should include the fix for the aliasing bug.

Given that I'm still having issues, I suspect that the implemented fix for the sprockets issue is not a complete fix.

That being said, the aliasing issue may actually be fixed in sprockets >= 3.0, but I can't use sprockets > 3.0 because of this issue with angular-rails-templates.

I'm new to both Bower, and Angular. My temporary solution to the above was to rename all instances of ct-ui-router-extras & ct.ui.router.extras (including file names) to ui-router-extras & ui.router.extras respectively.

While this is working, it's obviously not ideal. If anyone has a better solution, I welcome it.

Also, I wasn't sure if I should file a bug for sprockets or perhaps one with ui-router-extras (this bug already exists for angular-rails-tempaltes)

1

There are 1 answers

0
Sia On

I'm not sure what your exact fix for the sprockets issue was according to your question text. I'm not using ui-routers-extras yet, but to fix the ui-router issue, I added gem 'sprockets', '2.12.3' to my gemfile and then ran bundle update sprockets.

I know that may only be a partial fix for you, but wanted to make sure that part of the problem was separated from the ui-routers-extras problem.