shearichard
shearichard

Reputation: 8362

Emberjs : how to import after 'npm install'

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 did an npm install and subsequently got an update in package.json like this :

"dependencies": { "bootswatch": "^4.0.0", "howler": "^2.0.9", "npm": "^5.8.0" }

In the controller I added this import

import {Howl} from 'howler';

But when I try to execute the code I get a runtime error

Could not find module 'howler' imported from 'foo/controllers/bar'

When I do a find for *howl* this is what I find

./node_modules/howler/dist/howler.js ./node_modules/howler/dist/howler.core.min.js ./node_modules/howler/dist/howler.min.js ./node_modules/howler/dist/howler.spatial.min.js ./node_modules/howler/src/howler.core.js ./node_modules/howler/src/plugins/howler.spatial.js

Should my import have a path to these files as part of it ? If so which one ?

Would appreciate some advice about whether there's something obviously wrong in what I've done there.

Emberjs version is 3.0.

Thanks

Upvotes: 1

Views: 776

Answers (1)

Abhishek Gupta
Abhishek Gupta

Reputation: 1337

You can import the howler.js inside your ember-cli-build.js like this

app.import('node_modules/howler/dist/howler.min.js')

Then you can use Howl as global variable inside you ember app.

Upvotes: 3

Related Questions