rivets icon indicating copy to clipboard operation
rivets copied to clipboard

AMD (requirejs) with rivets.bundled not working correctly

Open im4LF opened this issue 11 years ago • 5 comments

With rivets.bundled — http://jsfiddle.net/meeg211u/

With separated rivets and sightglass — http://jsfiddle.net/r46ym8fz/

im4LF avatar Nov 27 '14 08:11 im4LF

I can confirm this behavior. I have also had to shim them to get it working with sep libraries:

    shim: {
        sightglass : {
            exports: 'sightglass'
        },
        rivets : {
            deps : ['sightglass'],
            exports : 'rivets'
        }
    }

Duder-onomy avatar Dec 09 '14 17:12 Duder-onomy

I can also confirm this behavior. Methods and properties such as rivets.configure and rivets.formatters are undefined. @Duder-onomy's solution worked for me as well.

tylerault avatar Jan 16 '15 15:01 tylerault

Thanks I was having this issue too, will include seperately

dominictobias avatar Feb 11 '15 12:02 dominictobias

one thing I am confused about with RequireJS

should it be

  shim: {
        sightglass : {
            exports: 'Sightglass'
        },
        rivets : {
            deps : ['sightglass'],
            exports : 'Rivets'
        }
    }

or

  shim: {
        sightglass : {
            exports: 'sightglass'
        },
        rivets : {
            deps : ['sightglass'],
            exports : 'rivets'
        }
    }

or does it make a difference?

ORESoftware avatar Jul 22 '15 21:07 ORESoftware

@ORESoftware In require.js, when shimming a dependency, the word you use to reference the dependency should be the same word defined in your paths.

if you had this in your require config:

paths : {
    angular : '/angular/is/totally/lame'
}

Then you would need to refer to it in your deps as 'angular'. You could have made it uppercase, or named it something totally ridiculous like hammerHeadCottonWillowsForLyfe and that is what it will be called in your application. That is also the word you would use in the define block of your modules.

The exports property of the shim is what require.js uses to name the dependencies export. More info on that here.

Please let us know if that unblocks you. Cheers.

Duder-onomy avatar Jul 22 '15 23:07 Duder-onomy