Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import jquery with ember-cli

Since ember-cli 0.0.34 jquery is removed from the .jshint file as predefined. So jquery needs to be imported, but I get the following error when doing it:

import $ from 'jquery'; 

The error I get is:

ENOENT, no such file or directory 'S:\...\tmp\tree_merger-tmp_dest_dir-Nb27WzDk.tmp\jquery.js' Error: ENOENT, no such file or directory 'S:\...\tmp\tree_merger-tmp_dest_dir-Nb27WzDk.tmp\jquery.js'     at Object.fs.statSync (fs.js:684:18)     at addModule (S:\...\node_modules\ember-cli\node_modules\broccoli-es6-concatenator\index.js:81:46)     ..... 
like image 460
Willem de Wit Avatar asked Jun 12 '14 09:06

Willem de Wit


People also ask

Can we use jQuery in Ember?

This addon makes jQuery available in an Ember project. It also provides the mechanism that implements jQuery integration when that feature is enabled.

How do I use Ajax in Ember JS?

Basic Usage In fact, ember-ajax is a wrapper around jQuery's method, and can be configured in much the same way. In general, you will use the request(url, options) method, where url is the destination of the request and options is a configuration hash for jQuery. ajax . import Ember from 'ember'; export default Ember.


1 Answers

I solved the problem by not importing jquery at all. jQuery is available via Ember.$ (link)

So I changed my code to use Ember.$(...) instead of $(...)

like image 197
Willem de Wit Avatar answered Oct 02 '22 17:10

Willem de Wit