引用requirejs,网速不好时,会提示require is not defined
有的时候,可以输出'aaa'
但有的时候,会// Uncaught ReferenceError: require is not defined
图片描述
require.config({
baseUrl: '<?php echo $this->config->base_url(); ?>',
paths: {
jquery: 'assets/js/jquery.min',
bootstrap: 'assets/js/bootstrap.min',
fastclick: 'assets/js/fastclick',
swal: 'assets/js/sweet-alert',
bootstrapSelect: 'assets/js/bootstrap-select.min',
ueditorConfig: 'assets/js/ueditor/ueditor.config',
ueditor: 'assets/js/ueditor/ueditor.all.min',
domReady: 'assets/js/domReady'
},
shim: {
bootstrap: {
deps: ['jquery'],
exports: 'bootstrap'
}
},
urlArgs: 'v=' + (new Date()).getTime()
});
require(['domReady'],function(domReady){
domReady(function(){
console.log('aaa');
});
});
// Uncaught ReferenceError: require is not defined
前端模块化 codeigniter php requirejs
被窝里有只熊猫
10 years, 2 months ago