1
votes

I have a local javascript in my application that i want to include in my ember-cli application.

it is called carrotsearch.foamtree.js

In order that it will be included i put it under vendor\foamtree\carrotsearch.foamtree and in the app.js i write

import CarrotSearchFoamTree from 'foamtree/carrotsearch.foamtree'

the problem is that i get an error

===== 1 JSHint Error

Build failed. ENOENT, no such file or directory 'C:\Users\davidga\Desktop\ember\nextgen\tmp\tree_merger-tmp_dest_dir-37cYqLzL.tmp\foamtree\carrotsearch.foamtree.js'

File: foamtree/carrotsearch.foamtree.js Error: ENOENT, no such file or directory C:\Users\davidga\Desktop\ember\nextgen\tmp\tree_merger-tmp_dest_dir-37cYqLzL.tmp\foamtree\carrotsearch.foamtree.js'

at Object.fs.statSync (fs.js:689:18) at addModule (C:\Users\davidga\Desktop\ember\nextgen\node_modules\ember-cli\no de_modules\broccoli-es6-concatenator\index.js:83:46) at addModule (C:\Users\davidga\Desktop\ember\nextgen\node_modules\ember-cli\no de_modules\broccoli-es6-concatenator\index.js:126:9) at C:\Users\davidga\Desktop\ember\nextgen\node_modules\ember-cli\node_modules\ broccoli-es6-concatenator\index.js:59:7 at tryCatch (C:\Users\davidga\Desktop\ember\nextgen\node_modules\ember-cli\nod e_modules\rsvp\dist\commonjs\rsvp-internal.js:163:16) at invokeCallback (C:\Users\davidga\Desktop\ember\nextgen\node_modules\ember-c li\node_modules\rsvp\dist\commonjs\rsvp-internal.js:172:17) at publish (C:\Users\davidga\Desktop\ember\nextgen\node_modules\ember-cli\node _modules\rsvp\dist\commonjs\rsvp-internal.js:150:13) at flush (C:\Users\davidga\Desktop\ember\nextgen\node_modules\ember-cli\node_m odules\rsvp\dist\commonjs\rsvp\asap.js:51:9) at process._tickCallback (node.js:419:13)

I thought that the problem is maybe bower related so i followed the following post how to include a private local file in javascript project using bower

The problem is that neither "foamtree": "foamtree/carrotsearch.foamtree.js"

nor

"foamtree": "vendor/foamtree/carrotsearch.foamtree.js"

works.

What may i do?

Thanks, David

2

2 Answers

2
votes

I found an answer.

In brocfile.js we can add the line

app.import('vendor/foamtree/carrotsearch.foamtree.js')

I don't know if this is an optimal anser but it works

Update:

This solution is stated in the ember-cli documentation

http://iamstef.net/ember-cli/#managing-dependencies

0
votes

If you don't need them to minified in your vendor.js file you can put them in the public/js and then include it as a normal script file in app/index.html. I use this method for some libraries like moment.js.

The public folder gets directly copied to your site root during the build.