scalableminds / amd-optimize

An AMD (RequireJS) optimizer that's stream-friendly. Made for gulp.
MIT License
162 stars 29 forks source link

Bug with shimmed dependensies #40

Open tamtakoe opened 9 years ago

tamtakoe commented 9 years ago

You add define to the end of simed file. F.e.

vendor.js

(function (global, factory) {
    ...
    return jQuery;
}));

//Add by amd-optimize
define('jQuery', [], function () {
    return;
});

I use compiled file with require.config (not the one that was used angular-amd)

require.config({
    baseUrl: '/app/',
    paths: {
        jquery: 'vendor',
        angular: 'vendor'
    }
    shim: {
        angular: ['jquery']
    }
}

It causes an error Uncaught TypeError: undefined is not a function. But it work if I move define section to top of vendor.js.

Move define sections to top of shimmed files.

normanrz commented 9 years ago

Sorry, I'm very busy at the moment. I'm happy to review any test case or PR.

tamtakoe commented 9 years ago

Ok. It is not critical. Thank you, all involved in the project! P.S. I do not know coffee for PR