Is there a way to use the bundle functionality of ASP.NET MVC4 and the JavaScript module dependency feature of require.js
I want to load all my modules with ASP.NET MVC4 bundle features and use require.js to organize the relationships between them.
The problem is that require.js doesn't find the needed dependencies while all the modules are loaded via bundles.
I don't want require.js to go and try to load files asynchronous I just want it to use already loaded modules via bundles.
What should the main file look like in this case.
I Have the following structure in _Layout.chtml
@Scripts.Render("~/bundles/jquery", "~/bundles/jqueryval", "~/bundles/jslibs", "~/Scripts/require.js", "~/bundles/tjProductivity", "~/Scripts/tjpApp/main.js" ) @RenderSection("scripts", required: false)
And then in each scripts section I want to load all modules that will be used for that page via Bundle.config but let require.js manage dependencies between them.
It's possible, use almond.js, from the creator of RequireJS.
The only shortcoming is that you have to always add the module names on your modules...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With