mgs
mgs

Reputation: 5176

Loading Breeze via AMD

I try to use Breeze together with: TypeScript, AMD modules, requirejs, knockout.

Looking at the Breeze code, I can see that it requires knockout via the name "ko". However, there are other components which require knockout via the name "knockout".

So, if I create a configuration for requirejs with the path "knockout", the loader will complain that "ko" has not been loaded yet. If I manually change the Breeze code, replacing "ko" with "knockout" anything works fine.

What can be done, so changing the Breeze code is not necessary?

Upvotes: 1

Views: 137

Answers (1)

Steve P
Steve P

Reputation: 19397

You can use the map config to remap any request that breeze makes for 'ko' to 'knockout'. Something like this:

require.config({
    //
    // your other config (e.g. paths)
    //

    // remap requests for 'ko'
    map: {
        'breeze': {
            'ko': 'knockout'
        }
    }
});

Or if you want to map those requests for 'ko' from all modules, you can use * wildcard:

map: {
    '*': {
        'ko': 'knockout'
    }
}

Upvotes: 5

Related Questions