0

I'm using chartist on my website. On localhost, it's fine. Everything is working.

When i deploy the website, i get 2 errors when i want to draw pie chart.

Others charts are working well.

The errors are the following :

Uncaught TypeError: Cannot set property 'chartist' of null

It refers to that part of code : return m.chartist=y,y

Uncaught TypeError: Cannot read property 'series' of undefined

It refers to that part of code: for(var t=[],n=0;n<e.series.length;n++)t[n]="object"==typeof e.series[n] ...

The only differences between dev and prod version is that i concat my JS (not uglify).

I can't give you more detail so I know it won't be easy for you to help, but i'm lost I spent hours on this and i still haven't figure it out. Any help would be really appreciated!

Thanks

5
  • 1
    Good news, you can absolutely give us more detail! 1) Post more of your JS where you are actually using the library. 2) Post your <script> tag you are using to include the chartist library. It's possible that you have a relative or absolute path that is only valid in dev 3) Only differences between dev and prod is that... Have you tried eliminating that difference? Try NOT minifying, uglifying, or modifying the code in anyway between dev and prod first and make sure that works. If it doesn't, then you'll know the problem isn't the minifying. Commented Apr 15, 2015 at 20:40
  • @MikeC Thanks for answering i know my question is not a "super" one as i didn't give much informations. I'll try to post you more details as soon as i get home but it won't be that easy as my grunt make a huge work ! I also found a new clue (or not ...) : In prod, it works well on firefox but the 2 errors i wrote about appear only in chrome ! Commented Apr 16, 2015 at 7:00
  • @MikeC thank you for your help !!! A friend of me & myself were struggling for 3 days now ... We finally found out ! In fact we had 2 differents functions with the same name. Once the js was concat, we had an error because of it but in chartist ... Really weird and hard to find but it's fine now ! Thanks again for your help Commented Apr 16, 2015 at 16:11
  • Glad to hear you got it figured out. I'll post my suggestion as an answer, if you'd accept it I'd appreciate it. Commented Apr 16, 2015 at 16:12
  • Sure thing go ahead :) Commented Apr 16, 2015 at 16:14

1 Answer 1

1

Try eliminating all differences between your production and development code. In this case, you are minifying the code first so try using it in production without minifying.

If it solves the problem, then you'll know something is going on in the minifying process.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.