Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4836

jQuery's ajaxError global event fires in prod Ember app but not in dev

$
0
0

@eduran wrote:

I have an Ember app that is part of a bigger Web application (ASP.NET MVC) and one of the many scripts the Web app loads (e.g. myapp.com/shared/ajax.js) defines a handler for jQuery's ajaxError global event. This handler will show a pop-up with a terse error message, which it's OK since it was considered kind of a "measure of last resort".

In my Ember app, I have a template (application-error.hbs) that handles the error sub-state at the application level, so any errors (including the ones coming from the RESTAdapter) get nicely rendered within the Ember app. Furthermore, while developing the Ember app and using it as part of the bigger Web app, back-end errors (e.g. 403 responses from my WebAPI server) never made it to the ajaxError global handler.

However, if I use the production version of my Ember app (e.g. ember build -prod), the generated vendor.js file (where jQuery is bundled) is somehow different because now any AJAX errors (e.g. RESTAdapter gets a 403 response) make it to the ajaxError global event. The following is the relevant part of my ember-cli-build.js file:

var EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
    vendorFiles: {
      'jquery.js': {
        development: 'bower_components/jquery/dist/jquery.js',
        production: false
      }
    },

I'd like to know the cause of the difference in behavior between the prod and non-prod version of the vendor.js file and how can I keep the non-prod behavior in the production version. I realize that maybe the behavior of the production version is the correct behavior or that maybe this has nothing to do with Ember CLI and it's totally jQuery's fault, so any in-depth explanaition would be greatly appreciated.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4836

Trending Articles