if (typeof jQuery === 'undefined') {
throw new Error('Bootstrap\ JavaScript requires jQuery')
}
Bootstrap only validates jQuery globally. When the browser tries to load Bootstrap, jQuery may not exist yet because RequireJS loads the modules asynchronously.
Bootstrap AMD. , RequireJS Bootstrap, jQuery, paths shim config. paths , shim RequireJS .
paths: {
// We tell RequireJS that `bootstrap` module is this file
bootstrap: 'path/to/bootstrap.js'
},
shim: {
// We tell RequireJS that `bootstrap` will need `jquery` loaded first
bootstrap: {
deps: ['jquery'],
},
}
main.js bootstrap .