Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

Running 'rake assets:precompile' in dev mode makes Rails include Highchart code twice (Uncaught Highcharts error #16) #26

Open
bluebird-communication opened this issue Apr 7, 2015 · 1 comment

Comments

@bluebird-communication
Copy link

I had problem with the error Uncaught Highcharts error #16 saying that Hightcharts was loaded twice.

I did not understand as I followed recommended settings in Highcharts-rails ReadMe.
My application is using Rails 3.2.21.

More explanation about my debug can be found here.

Finally, I found that there is a bug in rails when you do a rake assets:precompile that would lead to include twice the Javascript code from app/assets and public/assets.

This bug is referenced here since april 2013, but the rails community don't seem to be willing to correct it.

As workaround I just :

  1. run rake assets:clean
  2. add the line //= require highcharts to app/assets/javascripts/application.js
  3. run rake assets:precompile
  4. deleted the line //= require highcharts from app/assets/javascripts/application.js

So Highchart library is precompiled in assets pipeline from the public/assets.

Its a bit weird, but it works... in development...

I still have to test it in production to confirm that it continues to work.

Maybe it would be a good idea to warn in the Highcharts-rails ReadMe file that including Highcharts in the app/assets/javascript/application.js file could potentialy lead to the error #16 ?

@PerfectlyNormal
Copy link
Owner

@bluebird-communication is this still a problem? It's quite old, so I'm guessing (hoping) something probably changed, either in Rails or in Highcharts that makes this disappear

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

2 participants