I am using the font face observer in my react es6 project this way --
import FontFaceObserver from 'fontfaceobserver';
const openSansObserver = new FontFaceObserver('Open Sans');
Or even this , as is mentioned in the docs -
var FontFaceObserver = require('fontfaceobserver');
const openSansObserver = new FontFaceObserver('Open Sans');
and its throwing error such as this.
_fontfaceobserver2.default is not a constructor. / FontFaceObserver is not a constructor
Not using modules?
You can also download a copy and manually include it in your project. You can then use the global FontFaceObserver constructor to load your fonts. This somehow works for me as shown below, but above two should either be broken now or there is something in the way you guys export your module. If i am wrong please ignore this. Else kindly change the the export.
Working Version -
require('fontfaceobserver');
const openSansObserver = new FontFaceObserver('Open Sans');//eslint-disable-line no-undef
I am using the font face observer in my react es6 project this way --
import FontFaceObserver from 'fontfaceobserver';
const openSansObserver = new FontFaceObserver('Open Sans');
Or even this , as is mentioned in the docs -
var FontFaceObserver = require('fontfaceobserver');
const openSansObserver = new FontFaceObserver('Open Sans');
and its throwing error such as this.
_fontfaceobserver2.default is not a constructor. / FontFaceObserver is not a constructor
Not using modules?
You can also download a copy and manually include it in your project. You can then use the global FontFaceObserver constructor to load your fonts. This somehow works for me as shown below, but above two should either be broken now or there is something in the way you guys export your module. If i am wrong please ignore this. Else kindly change the the export.
Working Version -
require('fontfaceobserver');
const openSansObserver = new FontFaceObserver('Open Sans');//eslint-disable-line no-undef