Can I use this bower package somehow?


#1

I’ve googled my butt off and I don’t see any way to get this library loaded into ember.

I’ve gone through all this.

bower install node-uuid --save

# Brocfile.js
app.import('bower_components/node-uuid/uuid.js');                

And I’ve tried all sorts of variations of this

var uuid = require('uuid')  # require is not defined (it was also installed under node_modules)
uuid.v2()  # undefined
import uuid from 'node-uuid' # Could not find module `node-uuid`
import uuid from 'uuid' # Could not find module `uuid`

I’ve had no problems with getting app.import() working with things like bootstrap, simple-uuid, etc. What is so incompatable to ember about this particular bower package? Shouldn’t a apparently popular node module, that was even bower-ized, just plug and play in ember.js?


#2

Turns out it WAS as easy as adding to Brockfile.js

 app.import('./bower_components/node-uuid/uuid.js');               

and doing something like this:

console.log( uuid.v1() )                                                                                
```

But what threw me off was that whenever I ran

```
ember s
```

I would get the error and assume it wasn't going to work, but it still did
```
routes/index.js: line 5, col 34, 'uuid' is not defined.
```

Bug, or working as intended, it sure is misleading.

#3

I believe the jshint error on ember s is caused by you using it as a global reference. You can ignore this global message by placing

/*global uuid:false */

at the top of the file you use it in (routes/index.js) in this case