Closed paul-piro closed 8 years ago
You could wrap the code that uses almond in a closure so that the require/requirejs/define variables it uses are just usable inside that closure. If using the r.js optimizer to build the almond bundle, the wrap or wrap.start/end or wrap.startFile/endFile build options can help with that.
Closing as a discussion ticket, but feel free to continue discussion here.
I'm using grunt task to build production js. Could you give me some example how to use this closure?
Thank you
It depends on the kind of grunt task that is being used, but basically, if you are not using r.js to generate the bundle, you can prepend a (function(){
and append }());
to the generated file, that would be the same result as the wrap config.
I'm using grunt-contrib-requirejs task which i guess is using r.js to generate the bundle, so can i use Almond JS?
On Tue, Aug 16, 2016 at 5:05 AM, James Burke notifications@github.com wrote:
It depends on the kind of grunt task that is being used, but basically, if you are not using r.js to generate the bundle, you can prepend a (function(){ and append }()); to the generated file, that would be the same result as the wrap config.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/requirejs/almond/issues/119#issuecomment-239982385, or mute the thread https://github.com/notifications/unsubscribe-auth/AAh57l4UH2lKH0sj-PL8z2jUeZtYnXWSks5qgRrygaJpZM4JjIG7 .
I'm not very familiar with the grunt task, but I believe it allows passing the same config properties that r.js uses through it, so it should be able to use the wrap config properties mentioned above.
Almond JS doesn't work with Electron apps, the library is overriding the NodeJS require function and the app cannot include native modules like require('electron')
Can we rename the require function from Almond to requirejs ?