Requirejs加载超时问题的一个解决方法:设置waitSeconds=0
有时Requirejs会遇到加载js超时问题
除了排查js脚本问题,网络问题以外的一个解决方法是加大Require的等待时间waitSeconds,或者直接设置为0,这个参数的意义是:The number of seconds to wait before giving up on loading a script. Setting it to 0 disables the timeout. The default is 7 seconds.
引用别的帖子:
Load timeout for modules, Likely causes and fixes:
There was a script error in one of the listed modules. If there is no script error in the browser's error console, and if you are using Firebug, try loading the page in another browser like Chrome or Safari. Sometimes script errors do not show up in Firebug.
The path configuration for a module is incorrect. Check the "Net" or "Network" tab in the browser's developer tools to see if there was a 404 for an URL that would map to the module name. Make sure the script file is in the right place. In some cases you may need to use the paths configuration to fix the URL resolution for the script.
The paths config was used to set two module IDs to the same file, and that file only has one anonymous module in it. If module IDs "something" and "lib/something" are both configured to point to the same "scripts/libs/something.js" file, and something.js only has one anonymous module in it, this kind of timeout error can occur. The fix is to make sure all module ID references use the same ID (either choose "something" or "lib/something" for all references), or use map config.
解决方法:
<script src="scripts/require.js"></script>
<script>
require.config({
baseUrl: "/another/path",
paths: {
"some": "some/v1.0"
},
waitSeconds: 0
});
require( ["some/module", "my/module", "a.js", "b.js"],
function(someModule, myModule) {
//This function will be called when all the dependencies
//listed above are loaded. Note that this function could
//be called before the page is loaded.
//This callback is optional.
}
);
</script>
相关链接:
1.http://stackoverflow.com/questions/8582314/requirejs-and-text-plugin-load-timeout-for-modules
2.http://stackoverflow.com/questions/20288007/load-timeout-for-modules-with-requirejs
3.官网API文档:http://requirejs.org/docs/api.html#define
4.中文API文档:http://requirejs.cn/docs/api.html#define
5.中文API文档:http://makingmobile.org/docs/tools/requirejs-api-zh/#define
6.中文文档:http://www.zfanw.com/blog/require-js.html
7.中文文档:http://www.fanli7.net/a/bianchengyuyan/ASP/20130419/300243.html
8.http://requirejs.org/docs/api.html#config-waitSeconds
Requirejs加载超时问题的一个解决方法:设置waitSeconds=0的更多相关文章
- springboot+thymeleaf刨坑——首页加载js/css等失败解决方法
在使用thymeleaf加载css或js样式,当我们进入登录页的时候发现,所有的样式都是加载失败的.原因是在新版中有这样一个坑……: 当我们设置了addInterceptors-注册拦截器的时候,通常 ...
- AsyncTasLoader不进行加载操作的原因及解决方法
使用AsyncTaskLoader加载数据.但是LoadInBackground却不会被回调.这是什么情况?我要怎么解决这个问题?如果你和我一样有这样的疑问.你可以移步至我的blog的这篇文章找到答案 ...
- 不同网段无法加载ArcGIS Server发布服务解决方法
问题描述: ArcGIS Server 10发布的服务, (1)在相同网段的Desktop9.3和Engine 9.3程序下可以正常显示, (2)在不同网段Desktop9.3和Engine 9.3程 ...
- JAVA之中出现无法加载主类的情况解决方法
j今天打代码的时候出现了无法加载主类的情况,我就收集了一些,java无法加载主类的方法 ava无法加载主类解决办法 今天启动项目,又遇到找不到或无法加载主类的情况,清除项目后无法编译,class文件下 ...
- Winform使用ML.NET时无法加载 DLL“CpuMathNative”问题的解决方法
同样的代码运行在netcore下可以,运行在winform中就出现错误: 引发的异常:“System.DllNotFoundException”(位于 Microsoft.ML.Data.dll 中) ...
- linux 运行时加载不上动态库 解决方法(转)
1. 连接和运行时库文件搜索路径到设置 库文件在连接(静态库和共享库)和运行(仅限于使用共享库的程序)时被使用,其搜索路径是在系统中进行设置的.一般 Linux 系统把 /lib 和 /usr ...
- Django中加载static无法成功的解决方法
我试着进入/admin/ 结果它的/static/ 能够正常找到目标文件…真是日了哈*奇了. 我的link标签href=/static/…. 并没有什么问题 试着在urls中加入下面代码,但是没什么用 ...
- vue 动态加载图片路径报错解决方法
最近遇到图片路径加载报错的问题 之前一直都是把图片放到assets的文件下的.总是报错,看到一些文章并且尝试成功了,特意记录下 首先先说明下vue-cli的assets和static的两个文件的区别, ...
- 在eclipse中启动tomcat加载不了项目的解决方法
一.在server视图右键选择Add and Remove时,如果想要部署的项目不在左侧的待选列表中,或是弹出警告There are no resources that can be added or ...
随机推荐
- Android音频系统之AudioFlinger(四)
http://blog.csdn.net/xuesen_lin/article/details/8805096 1.1.1 AudioMixer 每一个MixerThread都有一个唯一对应的Audi ...
- [VBS]遍历XML文档
一.脚本源码 使用VBS脚本遍历XML文件 Option Explicit '定义常量 '元素 '文本 'CDATA '实体引用 '实体 '处理指令 '注释 '文档类型 '遍历文件 NameList. ...
- P1147连续自然数和
洛谷1147 连续自然数和 题目描述 对一个给定的自然数M,求出所有的连续的自然数段,这些连续的自然数段中的全部数之和为M. 例子:1998+1999+2000+2001+2002 = 10000,所 ...
- BestCoder Round #87 1001
GCD is Funny Accepts: 524 Submissions: 1147 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 655 ...
- Jade之Includes
Includes jade允许利用include将其他文件(支持filters所支持的类型)中的代码嵌入当前代码中. jade: //- index.jade doctype html html in ...
- javascript的原型和继承(1)
原型与继承是javascript中基础,重要而相对比较晦涩难解的内容.在图灵的网上看到一篇翻译过的文章,有参考了一些知名博客.我自己总结了几篇.通过这次的总结,感觉自己对原型和继承的认识又增加了很多, ...
- wav文件格式分析(二)
(三)格式分析 WAVE文件是由若干个Chunk组成的.按照在文件中的出现位置包括:RIFF WAVE Chunk, Format Chunk, Fact Chunk(可选), Data Chunk. ...
- ORACLE之UTL_FILE包详解
1 Utl_File包简介Oracle的UTL_FILE包用来实现对磁盘文件的I/O操作.(1)Oracle10g之前的版本需要指定utl_file包可以操作的目录. 方法: ...
- Connect教程系列--响应式布局(一)
微软终于跨平台了,最近在第九频道(Event-Visual Studio)下面出来一系列关于vs2015的视频,介绍vs2015以及.NET5.0的新特性等,现针对其讲解的.NET和ASP.NET,进 ...
- javascript高级程序设计阅读笔记(一)
javascript高级程序设计阅读笔记(一) 工作之余开发些web应用作为兴趣,在交互方面需要掌握javascript和css.HTML5等技术,因此读书笔记是必要的. javascript简介 J ...