requireJS优化器创建不起作用的代码
requirejs optimizer creates code that does not work
我在我的项目中使用"定义"。当我不使用优化器时,我的 js 代码会哗啦啦。当我运行优化器时,所有文件都包含在下面 se
require(["jquery", "modals", "registermodule", "bootstrap", "personsmodule", "datemodule", "./jquery-ui-1.8.18.custom.min"], function($) {});
C:/Users/pethel/checkout/src/main/webapp/resources/scripts/main-built.js
----------------
C:/Users/pethel/checkout/src/main/webapp/resources/scripts/jquery.js
C:/Users/pethel/checkout/src/main/webapp/resources/scripts/modals.js
C:/Users/pethel/checkout/src/main/webapp/resources/scripts/ajaxmodule.js
C:/Users/pethel/checkout/src/main/webapp/resources/scripts/jquery-ui-1.8.18.custom.min.js
C:/Users/pethel/checkout/src/main/webapp/resources/scripts/datemodule.js
C:/Users/pethel/checkout/src/main/webapp/resources/scripts/validationmodule.js
C:/Users/pethel/checkout/src/main/webapp/resources/scripts/guimodule.js
C:/Users/pethel/checkout/src/main/webapp/resources/scripts/registration_util.js
C:/Users/pethel/checkout/src/main/webapp/resources/scripts/registermodule.js
C:/Users/pethel/checkout/src/main/webapp/resources/scripts/bootstrap.js
C:/Users/pethel/checkout/src/main/webapp/resources/scripts/tablesort.js
C:/Users/pethel/checkout/src/main/webapp/resources/scripts/personsmodule.js
C:/Users/pethel/checkout/src/main/webapp/resources/scripts/main.js
当我使用丑陋的脚本加载我的页面时,我得到未定义的日期选择器。当文件包含在此处jquery-ui-1.8.18.custom.min.js时,怎么会发生这种情况?
问题是jquery-ui-1.8.18.custom.min.js不是AMD模块。
解决方案 1:将 jquery-ui 的代码包装到 AMD 模块
解决方案 2:删除代码中的依赖项并手动包含它。
还有其他解决方案如何使用非AMD依赖项,但我不知道在这种情况下优化器将如何工作。
相关文章:
- d3js文本传输-示例代码不起作用
- 滚动动画代码不起作用
- 为什么此验证代码不起作用
- 我的jquery代码不起作用.为什么?
- jquery中的PHP代码不起作用
- 谷歌地图代码不起作用
- 为什么这个代码不起作用?我花了很长时间试图弄清楚这一点
- 除非连接插件,否则 jQuery 代码不起作用
- 简单的JavaScript代码不起作用
- Angular资源对我的代码不起作用
- 在加载javascript之前让页面加载的代码不起作用
- 为什么这个jquery代码不起作用
- 直接从代码笔复制的圆环图代码不起作用
- javascript代码不起作用
- javascript验证代码不起作用
- 代码不起作用.我无法确定这个问题
- 为什么这个js代码不起作用
- 重定向到PDF时像素跟踪代码不起作用
- hasClass没有'我的js代码不起作用
- JavaScript-为什么这段代码不起作用