This project has moved. For the latest updates, please go here.

Require.js bundles

Aug 19, 2012 at 7:28 PM
Edited Aug 19, 2012 at 7:32 PM

https://github.com/jrburke/r.js

http://requirejs.org/docs/optimization.html

 

Wondering how possible it would be to add a bundle transformer for (javascript) require.js AMD modules.

Coordinator
Aug 30, 2012 at 3:28 PM
Edited Aug 30, 2012 at 3:29 PM

Hi, chrisux!

If we consider RequireJS as a client side script loader, then does not happen implement support RequireJS in the Bundle Transformer. Need to understand that the Bundle Transformer is just an extension for the Microsoft ASP.NET Web Optimization Framework, which adds new features (mostly translation and minification of the code) and eliminates some shortcomings. Support RequireJS can appear only, if this functionality will be implemented in the Microsoft ASP.NET Web Optimization Framework. Fortunately, the Web optimization team of Microsoft is already considering the support of client side script loaders, as a candidate for implementation in new version of the Microsoft ASP.NET Web Optimization Framework. Recommend you read Howard Dierking's blog posts: "What's Next for ASP.NET Web Optimization" and "Keeping in touch with the Web optimization team".

If you are considering RequireJS, as a means minification of code, i don't see the point in his support, because it uses to minification of code the Closure Compiler and UglifyJS, whose support is implemented in a the Bundle Transformer in the form of separate modules.

Aug 31, 2012 at 5:18 PM
Edited Aug 31, 2012 at 5:55 PM

Require.js is more than a clientside script module, it is also a pattern to build AMD(pattern) javascript modules.

The require optimizer does more than just minify/package, it also goes through the require/amd module syntax in your javascript lib files and creates module packaging that simply packing and minifying don't do alone, it also is running require.js as part of the build process to find and package your modules based on their requirements, which is why it has a build process beyond just closure/uglify.
( http://requirejs.org/docs/api.html#modulename )
( https://github.com/jrburke/r.js#what-makes-it-special )


So as part of my build process right now, I am using command line to run a java command to run the optimizer to package/minify the scripts the AMD way which is different by necessity than just standard closure/uglify.

With these new tools with the Web Optimization, I figure we can (or eventually can) do this without command line to run java or node.

It is just a curiosity.

Thanks for the feedback!

Aug 31, 2012 at 6:04 PM
Edited Aug 31, 2012 at 6:16 PM

 

Another resource that gives more insight to the issue is

https://github.com/jrburke/r.js/issues/201

and the number of requests for require.js support on the "What's Next for ASP.Net Web Optimization" link you provided.

Aug 31, 2012 at 6:21 PM
Edited Aug 31, 2012 at 7:00 PM

It is also being discussed (and worked on) in Cassette.

https://github.com/andrewdavey/cassette/issues/248