2016-07-28 9 views
0

Ich habe ein reaktives SPA entwickelt und es funktioniert gut auf allen Browsern außer Safari Fehler, die ich in meiner Konsole erhalten wird unten als ein Bild angehängt.Reactjs Webapp gibt Fehler nur im Safari Browser - 'undefined' ist keine Funktion (Bewertung 'ReactElementValidator.createElement.bind (null, type)')

Fehler aus zwei Dateien kommt. eine davon ist der Schriften-awesome CDN Link

und andere stammt aus meinem Bündel js, die den Code erstellt wird

gulp.task("bundle", function() { 
return browserify({ 
    entries: "./app/js/index.jsx", 
    debug: true 
}).transform(reactify) 
    .bundle() 
    .pipe(source("bundle.js")) 
    .pipe(gulp.dest("app/")) 

}) 

Alle Links, warum dieses Problem besteht entstehen? Danke im Voraus.

Error console for Safari

Antwort

0

Hinzufügen polyfills für bind das Problem behoben.

`if (!Function.prototype.bind) { 
    Function.prototype.bind = function(oThis) { 
    if (typeof this !== 'function') { 
     // closest thing possible to the ECMAScript 5 
     // internal IsCallable function 
    throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); 
} 

var aArgs = Array.prototype.slice.call(arguments, 1), 
    fToBind = this, 
    fNOP = function() {}, 
    fBound = function() { 
     return fToBind.apply(this instanceof fNOP 
      ? this 
      : oThis, 
      aArgs.concat(Array.prototype.slice.call(arguments))); 
    }; 

if (this.prototype) { 
    // Function.prototype doesn't have a prototype property 
    fNOP.prototype = this.prototype; 
} 
fBound.prototype = new fNOP(); 

return fBound; 
}; 
} 

`

Nachdem diese Fixierung, bekam ich einen anderen Fehler mit INTL REACT, die außer Safari auf allen Browsern funktioniert. Es gibt also eine Polyfill für diese Website auch auf ihrer Website.