David Ferris David Ferris - 1 year ago 158
Javascript Question

How to use javascript library? (Ember JS)

Simple question here, but I can't seem to figure out how to use a dependency I've installed in my ember JS app. I installed the twitter fetcher library via bower.

enter image description here

I have a twitter-container component, and inside of my component.js:

import Ember from 'ember';
export default Ember.Component.extend({
loadPlugin: function() {
var config1 = {
"domId": 'example1',
"maxTweets": 1,
"enableLinks": true

I get a 'twitterFetcher is not defined' error (obviously), but am not sure how to import it. Should I include a line like this?

import twitterFetcher from 'bower_components/twitter-fetcher'

Answer Source

In ember-cli-build.js, you need to include the below line to bundle it in ember app,