rondale-sc / ember-cli-rails-addon

27 stars 37 forks source link

Update to support newest versions of Ember #31

Open ghost opened 8 years ago

ghost commented 8 years ago

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

ihoka commented 8 years ago

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);
  }
ghost commented 8 years ago

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

nruth commented 8 years ago

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

pwim commented 7 years ago

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?

seanpdoyle commented 7 years ago

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!).