Search code examples
jqueryruby-on-railsember.jsember-cli

Don't include jquery in a Rails app using ember-cli with ember-cli-rails


I have an existing Rails app that I'm adding an ember-cli app to using the ember-cli-rails gem. The Rails app already includes jquery and jquery-ui via the Rails asset pipeline and the jquery-rails gem.

Ember-cli also includes a different version of jquery which when loaded doesn't have the previously included jquery-ui components loaded.

I want to disable the Ember-cli jquery and just use the one already included.


Solution

  • In rails_app/config/initializers/ember.rb

    EmberCLI.configure do |c|
        c.app :frontend, path: Rails.root.join('frontend').to_s, exclude_ember_deps: ['jquery']
    end
    

    This can be done for any file that Ember-cli includes via the ember-cli-rails-addon NPM module in: ember-cli-rails-addon/index.js:include()