ember-cli-rails-addon
ember-cli-rails-addon copied to clipboard
Update to support newest versions of Ember
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
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);
}
This worked for me after updating to the latest ember-cli and ember (2.5.x)
Does this only affect exclude_ember_deps
or break the addon entirely? What about apps that don't use that feature?
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?
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!).