Howler.js: Importing howler

Created on 9 Jan 2017  路  10Comments  路  Source: goldfire/howler.js

I have installed howler using bower. I am looking for a es6 import way to import the library.

something like import howler from 'howler'; but I couldn't find anything in the documentation and trying that also doesn't work.

Am i missing something?

Most helpful comment

All the comments above seem to indicate a workflow using Babel to transpile, which allows importing variables that aren't exports. In ES2015, you can't import non-exports. Is there a pure ES2015-way to do this? Or is someone working on making Howler ES modules compatible?

All 10 comments

Does import * from 'howler' work?

Just tried out: this worked for me:

import { Howl } from 'howler'

var sound = new Howl({
  src: ['/static/sounds/clock.ogg']
})

My package.json has

  "dependencies": {
    "ember-cli": "^2.7",
    ...
    ...
    "howler": "^2.0.2"
  }

and I am doing this in my modules:

import { Howl } from 'howler';

but I continue to get Could not find module howler

  at missingModule (vendor.js:248)
    at findModule (vendor.js:259)
    at Module.findDeps (vendor.js:199)
    at findModule (vendor.js:262)
    at Module.findDeps (vendor.js:199)
    at findModule (vendor.js:262)
    at requireModule (vendor.js:29)
    at Class._extractDefaultExport (vendor.js:67027)
    at Class.resolveOther (vendor.js:66724)
    at Class.superWrapper [as resolveOther] (vendor.js:36055)

Can you reinstall it to make sure the package is installed?

Was this ever resolved?

I'm able to use import { Howl } from 'howler'; without any issues as well. Closing for now, but if there is still an issue I'll reopen.

All the comments above seem to indicate a workflow using Babel to transpile, which allows importing variables that aren't exports. In ES2015, you can't import non-exports. Is there a pure ES2015-way to do this? Or is someone working on making Howler ES modules compatible?

Still no ES2015 compatible modules ?

Same problem here. Please rewrite this with proper ES6 exports. Please please.

@goldfire The problem being faced here is that exports work for tools such as CommonJS (which use "exports"), but they don't work if you use no additional libraries, because in that case you use "export" (note the missing "s") and "exports" is undefined. Thus you get no exports and can't import it as module either (See MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules), at least that's what it looks like to me.

As of now (2.2.1), this is still an issue. I ran into it today.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

inglesuniversal picture inglesuniversal  路  4Comments

bflora2 picture bflora2  路  4Comments

tvbird picture tvbird  路  4Comments

FFankias picture FFankias  路  3Comments

SandMoshi picture SandMoshi  路  3Comments