Does anyone have any experience with or know any good solutions for bundling and minifying modular JavaScript like RequireJS / AMD in an ASP.NET MVC project?
Is the
These are the steps to get RequireJS bundled with main.js. You can get down to one line in the tag. This does not address the issue with anonymous defines.
HTML
<%: System.Web.Optimization.Scripts.Render("~/bundles/scripts") %>
BundleConfig.cs
using System.Web;
using System.Web.Optimization;
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/scripts").Include(
"~/scripts/libs/require.js",
"~/scripts/main.js"));
}
}
main.js must work without data-main (I needed to set baseUrl)
require.config({
baseUrl: "scripts"
});