ember-cli-bootstrap icon indicating copy to clipboard operation
ember-cli-bootstrap copied to clipboard

addon breaks other addons

Open abuiles opened this issue 10 years ago • 9 comments

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.

abuiles avatar Oct 14 '14 13:10 abuiles

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

linstula avatar Oct 14 '14 13:10 linstula

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

abuiles avatar Oct 14 '14 13:10 abuiles

Sorry, closed it by mistake.

abuiles avatar Oct 14 '14 13:10 abuiles

@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'));
    });

abuiles avatar Oct 15 '14 00:10 abuiles

:+1:

linstula avatar Oct 15 '14 00:10 linstula

@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 avatar Oct 15 '14 01:10 abuiles

@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 avatar Oct 16 '14 03:10 abuiles

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

abuiles avatar Oct 16 '14 03:10 abuiles

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.

linstula avatar Oct 16 '14 04:10 linstula