I'm trying to deploy a rather large project at the moment, and I'm running into some weird js issues in production. In development, everything works perfectly fine. After precompiling my assets (the javascript is compiled with r.js by means of the requirejs-rails gem), I am left with a single compressed javascript file. Whats weird here is that when I load the web page, I start getting errors in the compressed js file, even though in development the code is error-free, and even though my assets compressed without an issue. I prettified the compressed file and reloaded the page with the expanded version. Most of these errors are appearing in libraries I didn't write. Is there any reason why compiling all of these files together with r.js would create so many errors?
Here is my require.js yml, which is used to generate the r.js build.
paths:
backbone : 'libs/backbone'
marionette : 'libs/backbone.marionette'
jquery : 'libs/jquery'
snap : 'libs/snap'
transit : 'libs/transit'
underscore : 'libs/underscore'
text : 'libs/text'
image : 'libs/image'
cookie : 'libs/jquery.cookie'
notify : 'libs/notify-bar'
leaflet : 'libs/leaflet'
mapbox : "http://api.tiles.mapbox.com/mapbox.js/v1.0.2/mapbox"
landing : 'front_end/home/landing'
logo : 'front_end/home/logo'
faq : 'front_end/home/faq'
about : 'front_end/home/about'
shim:
leaflet:
'deps' : ['jquery']
'exports' : 'Leaflet'
mapbox:
'deps': ['leaflet']
'exports': 'L'
backbone:
'deps' : ['jquery', 'underscore']
'exports' : 'Backbone'
marionette:
'deps' : ['backbone','jquery','underscore']
'exports' : 'Marionette'
handlebars:
'exports' : "Handlebars"
snap:
'deps' : ['jquery']
'exports' : 'Snap'
transit:
'deps' : ['jquery']
'exports' : 'Transit'
underscore:
'exports' : '_'
notify:
'deps' : ['jquery']
'exports' : 'Notify'
jquery:
'exports' : "$"
name: "application"