First, ShimRequirejs is developed using AMD specifications and is configured using Requirejs
shim If the non-AMD specification JS is loaded during development.
The shim configuration syntax is:
//configuration fileRequirejs.config ({baseUrl:' JS ',//By default, the folder where Main.js is located is the benchmark. paths: {jquery:' Jquery-1.12.4.min '//from the individual name }, //Key ConfigurationShim: {//Configuration Method One: Jquery.catenav is the module name, JQuery is a dependent JS module //' Jquery.catenav ': [' jQuery '] //configuration Mode Two: Jquery.catenav is the module name, Deps is a configuration-dependent JS module, Deps array, indicating the module's dependency' Jquery.catenav ': {deps: [' jquery '], exports:"Catenav" } }});//loading the ingress moduleRequirejs ([' Index ']);//start looking for index.js from the reference path JS
Ii. examples
Specific code examples refer to my GitHub address:Https://github.com/MengFangui/require-shim/tree/master
The sample code is a plug-in for the jquery-based anchor scrolling effect, the pluginit's me. Development based on jquery (without
AMD specification), component address: http://www.cnblogs.com/mengfangui/p/7428500.html
The sample code enables the modular development of the non-AMD specification of JS loading.
Shim configuration of modular development Requirejs