JavaScript Works in Development, Not in Production (Heroku) - javascript

So I just pushed an app to Heroku, and JavaScript and jQuery are not working for me.
Have looked at a bunch of solutions for this but none seem to be work.
I have precompiled my assets, and I can see in Firebug that some of the functions I have declared in some of my js files in the assets folder are loading but some are not.
Edit: Just added a very simple alert function which works just fine.
Images are loading fine, styles are loading fine. Have rails_12factor gem and have run bundle exec rake assets:precompile. Can anyone point me in the right direction in terms of debugging?

So, I was getting this error;
'undefined' is not an object (evaluating 'f.msie')
which was resulting from one of the plugins using $.browser which has since been removed.
Installed jQuery migrate gem, re-pushed code, all jQuery and javascript now works.
Thanks to anyone who took the time to look this over.

Related

Failed to load resource (JS files in PACK) in Ruby on Rails project

Everything was nice, I did a minor change installing a gem to use Google Analytics and for a while all worked fine. At some point I realized all the javascript in /packs/ was not being loaded. After hours trying to fix it I decided to make a git reset --hard to a previous version in which everything worked.
My surprise was that this error keep happening. It failed to load the javascript in /pack/ (I use also StimulusJS).
I have tried all I have found:
turning config.assets.compile to true
checking StimulusJS initial configuration
using diff to see for typos...
Nothing.
It seems it happens just in production.
What am I missing?
Repo: https://github.com/juansecaro/guialocal

Where is webpack serving these up?

Our company decided not to use webpack after doing a test run but we are still seeing the following screenshot in our browsers and the bundled files there are still causing issues. I dont see them anywhere on the filesystem
Does anyone know how or where this gets generated? I've commented out all of our webpack config files even the package json but its still there any thoughts? No process is running from what I can tell either.
I just found it we still had one of the webpack generated js files left and so on pages that called that generated file, all the the import statements were then being called and grabbing the src files as well. Hopefully that made sense but I've got the issue resolved.

ngCordova Plugins - Issue getting cordova.js included properly

I've been trying everything for the past two days to solve this issue. I'm well and truly stumped. Perhaps someone with greater knowledge than I can shed some light on the issue:
Basically, I'm building an app in AngularJS with the purpose of building Android and iOS apps from it using Cordova. I should specify that I am using cordova-cli on Linux and ngCordova (wrapper around plugins). I am NOT using Ionic Framework.
My app works fine in Chrome. I followed the ngCordova installation guide perfectly: http://ngcordova.com/docs/install/
I used bower to install. Then included the following in the index.html of my Web App project (not the Cordova project):
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
It didn't work. I thought maybe it's because the ng-cordova.js went into my bower components directory. So I changed that script tag to:
bower_components/ngCordova/dist/ng-cordova.js
When I go to my cordova project directory and set up the platforms, plugins etc... and run:
cordova build android
followed by
cordova run android
The app runs on my device (Nexus 5). I use chrome://inspect to see what happens when I click the button which should be using the email composer plugin: I get a cordova not defined error.
I went into the controller and put this in
console.log($cordovaEmailComposer);
I can examine this in chrome://insepct and it has all the correct functions etc.. so ng-cordova.js is running fine (thats where the factory for the plugin is).
I'm 99% sure the issue is that somewhere along the line cordova.js is being lost. When I go into the cordova project in the ProjectName/www/index.html the tag for cordova.js is commented out.
Same in the platforms/android/assets/www/index.html file.
I traced it back and the same is true in WebAppProject/dist/index.html file. It's commented out. So it seems that when I run grunt build cordova.js is being removed. I thought maybe it's because cordova.js wasn't in the WebAppProject so I brought it into the root directory (same locations as index.html) and it still happened.
Can anyone explain how to properly get this working? I'm totally at a loss. I've tried a million different ways of including cordova.js. I even manually uncommented it out in the cordovaproject/www/index.html. The app builds but crashs upon opening (white screen then dies) suggesting a missing script (despite cordova.js being n that directory too...).
Is this the grunt build process? Or am I totally setting up an ngCordova project incorrectly without realising... I would post some code but I'm 99% sure the issue is with cordova.js or the way the project is building upon either grunt build or cordova build.
Any help would be much appreciated. :)
Cheers,
D
Make sure to include ngCordova before cordova.js and after angular.js.
<script src="/path/to/angular.js"></script>
<script src="/path/to/ng-cordova.js"></script>
<script src="/path/to/cordova.js"></script>

meteor.js app running normaly on localhost but not on server

I have this app that seems to run normally on localhost but when I deployed it to meteor or digital ocean, then from sudden reason, no functionalities work...
Here is the screencast localy: http://screencast.com/t/tyD995EyM
Here is the current hosted version on meteor: cryptonic.meteor.com
And digital ocean: 104.236.90.81
Code repo on git if it helps... https://github.com/lklancir/cryptonic
Could anyone at least help me locate the problem or point in direction, no major console log errors...
I might be guessing that maybe some JS files are killing each other when composed in one single .js file on upload, but why does it work locally is the thing that bothers me
I do see this error in the console on the meteor.com site...
Uncaught ReferenceError: gnMenu is not defined
I'm not completely sure, but I think it might be a file loading order. You have client/lib/custom.js which uses gnMenu from client/lib/gnmenu.js
Since all files in lib are loaded first, there might be a load order issue. Per the http://docs.meteor.com/#/full/structuringyourapp page, the files should be loaded from lib in alphabetical order so this would be an issue as custom.js would be loaded first, but I do not know why it would work on local...
HTML template files are always loaded before everything else
Files beginning with main. are loaded last
Files inside any lib/ directory are loaded next
Files with deeper paths are loaded next
Files are then loaded in alphabetical order of the entire path

Problems with using ncp inside my grunt plugin

for some reasons, I´m doing a custom grunt plugin for copy some specific directories. The idea for the plugin is to pass a parameter from console with the source path.
I´m using ncp module to copy directories but inside my grunt plugin doesn´t work (If I use node to execute the code, all works fine... the directories are created... the files and directories and files are copied).
It doesn´t do anything... no ok console message... no error console message... I´ve being debugging inside the ncp code and I´ve discovered that the function fs.lstat it doesn´t work.
I´ve reviewed that the source path and the destination path are ok... so... I don´t know... maybe is a nonsense but I can´t find it ;)
You can see both examples via Gist:
Using Node: when the task is completed, show me the "done!" message.
Using Grunt: it doesn´t do anything... only create the destination directory.
Thanks.
I´ve found a solution that its works for my intentions. I´d have liked to use grunt copy task inside of my plugin but I couldn´t config the correct values manually.

Categories

Resources