ember-cli-rails-addon icon indicating copy to clipboard operation
ember-cli-rails-addon copied to clipboard

Update to support newest versions of Ember

Open ghost opened this issue 8 years ago • 5 comments

The newest versions of Ember have altered the way legacyFilesToAppend works. This affects exclude_ember_deps.

Currently, this addon does not work with EmberCLI 2.4.1 or higher. https://github.com/ember-cli/ember-cli/releases/tag/v2.4.1

ghost avatar Apr 19 '16 20:04 ghost

As a workaround, you can edit your ember app's ember-cli-build.js file, and splice out the files. e.g. here is how you would exclude jQuery from the ember-cli build:

  // remove jQuery from build because it is already loaded by Rails
  var vendor = app._scriptOutputFiles['/assets/vendor.js'];
  var index = vendor.indexOf('bower_components/jquery/dist/jquery.js');
  if (index > 0) {
    vendor.splice(index, 1);
  }

ihoka avatar Apr 22 '16 11:04 ihoka

This worked for me after updating to the latest ember-cli and ember (2.5.x)

ghost avatar Apr 28 '16 18:04 ghost

Does this only affect exclude_ember_deps or break the addon entirely? What about apps that don't use that feature?

nruth avatar May 02 '16 17:05 nruth

The disadvantage of @ihoka's workaround is that it nukes jquery entirely from your ember application, meaning it will break your ember-cli tests.

I've discovered that ember-cli actually supports excluding a specific asset, so I'm not sure exclude_ember_deps is needed.

To get my app to work, I customized my ember-cli-build.js with the following to exclude jquery:

var app = new EmberApp(defaults, {
  vendorFiles: {
    'jquery.js': {
      test: 'bower_components/jquery/dist/jquery.js',
      production: false
    }
  }
});

Unless I'm missing a use case, I'd suggest removing exclude_ember_deps from ember-cli-rails. Thoughts @seanpdoyle?

pwim avatar Jan 17 '17 08:01 pwim

Unless I'm missing a use case, I'd suggest removing exclude_ember_deps from ember-cli-rails.

I'm in favor of this.

I'll investigate when I have some free cycles (PRs welcome!).

seanpdoyle avatar Jan 17 '17 15:01 seanpdoyle