requirejs-config
v1.0.5
Published
The small utilities to load require.js config path and shim configuration.
Downloads
28
Readme
requirejs-config
The small utilities to load require.js config path and shim configuration.
How to use
All the sample written in es6 then precompiled to umd modules.
html:
<script data-main="main" src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script>
config.jsx
export default {
paths : {
"react" : "//unpkg.com/[email protected]/umd/react.development",
"react-dom" : "//unpkg.com/[email protected]/umd/react-dom.development",
},
shim: {
},
}
config2.jsx
export default {
paths : {
"jquery" : "//unpkg.com/[email protected]/dist/jquery.min",
},
shim: {
'jquery' : {
exports: '$'
},
},
}
main.jsx
import loadConfig from "//unpkg.com/[email protected]/index.min";
loadConfig(['./config', './config2'], ()=>{
require(['react', 'jquery'], (React, JQuery) =>{
console.log(React);
console.log(JQuery);
});
});