dimanche 29 avril 2018

Emberjs / ember-browserify : "X is not a constructor"?

This question relates to my earlier question.

Trying to use howler.js (https://github.com/goldfire/howler.js#documentation) in a Controller.

There is no addon for Howler but it exists as a npm package.

I've followed the instructions to use ember-browserify and then started the ember dev server (ember s).

The import looks like this :

import Howl from "npm:howler";

I've also tried this :

import {Howl as Howl} from "npm:howler" ;

and this :

import {Howl} from "npm:howler" ;

In all cases when I attempt to make use of Howler like this :

var sound = new Howl({
    src: ['https://example.com/foo.mp3']
});
sound.play();

I get an error in the console (first import shown above) :

Uncaught TypeError: _npmHowler.default is not a constructor

or (second and third import shown above) :

Uncaught TypeError: _npmHowler.Howl is not a constructor

The example code for Howler is here and as far as I can see what I'm doing is in line with those examples.

Any suggestions welcome.


FWIW: this is the same body of code as is mentioned here but since that question I've moved onto using ember-browserify




Aucun commentaire:

Enregistrer un commentaire