-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue in declaring the Class in es6 project. #102
Comments
Hmm, this looks specific to your project or transpiler. If you have a reproducible test case I can have a look. |
I'm having the same issue, I'm using https://github.com/react-boilerplate/react-boilerplate as it |
I checked out react-boilerplate and I can't reproduce this. It works out of the box (the boilerplate already includes Font Face Observer). |
Can you check my repo @bramstein. https://github.com/MVSTEJA/React-Redux-BoilerPlate-Es6. Against this path :- React-Redux-BoilerPlate-Es6/src/main.js . |
@MVSTEJA Can you try upgrading to the 2.x branch of Font Face Observer? The only major API change is that the |
Do you plan to publish a full es6 version with proper imports at some point? |
@renestalder Yea, that might be a good idea. I was waiting for browser support to catch up (re: modules), and then I'll have a look at it. |
I would really love if FFO was written as an ES6 module, with dist outputs still suitable for direct browser inclusion. Right now, using FFO in ES6 involves still doing a It's uncomfortable to have consumers of FFO rely on the output of google's closure compiler, instead of allowing their own build tools to perform tree shaking. FFO, as a relatively small library, likely does not benefit much from closure's advanced compilation settings. Users consuming the minified library file (the only option) will not be able to plumb source maps all the way through FFO, and will also likely suffer a double minification penalty. |
yes please +1 |
confirming this issue. does not work with es6 imports. |
Having issues with imports as well. |
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
The text was updated successfully, but these errors were encountered: