Simon Boudrias
Simon Boudrias

Reputation: 44589

Require.js How to take shim config into account with plugins

I'm building a require.js loader plugins and I have trouble when using my plugins with a module using a shim config.

My plugins load the right path, but it won't rely on any of the shim setting like deps or exports.

Does the plugin need to take care of parsing the shim config, or is there a special function to be sure require.js parse the shim ?

Thanks!

Upvotes: 1

Views: 434

Answers (1)

Simon Boudrias
Simon Boudrias

Reputation: 44589

Been able to resolve my issue.

You need to make sure to require the module name (and not the path), and make sure you return this require call return value in the onLoad callback

Like so

req(toLoad, function ( value ) {
    onLoad( value );
});

Upvotes: 1

Related Questions