linstula / ember-cli-bootstrap

ember-cli addon for Twitter Bootstrap
37 stars 20 forks source link

addon breaks other addons #22

Open abuiles opened 10 years ago

abuiles commented 10 years ago

Hey, I just came to this really weird situation where I wasn't able to import things from a namespaced addon when running on production environment.

The root of the issue is ember-cli-bootstrap, If I remove it then everything works as expected.

I created the following repo where the issue can be reproduced https://github.com/abuiles/______ember-with-csrf

Run ember server --environment production and then go to localhost:4200, you will see the errors:

2014-10-14 08:31:00.240Uncaught TypeError: undefined is not a function vendor-a1334da90d004ed95bee447978c6258d.js:15
2014-10-14 08:31:00.243Uncaught Error: Could not find module rails-csrf/config vendor-a1334da90d004ed95bee447978c6258d.js:1

If I remove ember-cli-bootstrap the issue disappears.

linstula commented 10 years ago

Thanks @abuiles, I'll dig in to this when I get some time

abuiles commented 10 years ago

@linstula thanks! btw this is only when env==production

abuiles commented 10 years ago

Sorry, closed it by mistake.

abuiles commented 10 years ago

@linstula quick update, I just nailed down the issue to the following lines in the index.js

    app.import(path.join(javascriptsPath, 'bs-core.max.js')); // Import bs-core first

    jsFiles.forEach(function(file) {
      var fileName = file.split('.')[0];
      app.import(path.join(javascriptsPath, fileName + '.max.js'));
    });
linstula commented 10 years ago

:+1:

abuiles commented 10 years ago

@linstula is something around here https://github.com/dockyard/ember-cli-bootstrap/blob/master/vendor/ember-addons.bs_for_ember/dist/js/bs-core.max.js#L418

Edit: If I uncomment the following it works https://github.com/dockyard/ember-cli-bootstrap/blob/master/vendor/ember-addons.bs_for_ember/dist/js/bs-core.max.js#L420

abuiles commented 10 years ago

@linstula The root of the problem is the following Ember.Handlebars.compile in https://github.com/dockyard/ember-cli-bootstrap/blob/master/vendor/ember-addons.bs_for_ember/dist/js/bs-core.max.js#L420

When running ember build --production ember-cli builds with handlebars.runtime.js which doesn't have .compile.

abuiles commented 10 years ago

More info https://github.com/ember-addons/bootstrap-for-ember/issues/87

linstula commented 10 years ago

I was under the impression that bootstrap_for_ember had resolved their issues with using Ember.Handlebars.compile. Thanks for tracking this down. I'll dig into it and see what can be done but likely wont have time until next week to do so.