我在 require.js 中有这个路径
require.config({
"paths": {
"jquery": "../../../../../endeavour-ui-common/src/main/webapp/js/libs/jquery/jquery-1.8.2.min",
....
},
"shim"{
....
它给了我
Error: scripterror: Illegal path or script error: ['jquery']
我可以确保路径正确,因为相同的路径在终端中打开文件。例如:
open ../../../../../endeavour-ui-common/src/main/webapp/js/libs/jquery/jquery-1.8.2.min.js
知道如何解决这个问题吗?
最佳答案
这可能会有所帮助 Generate URLs relative to module:
正如 @codingGorilla 所说,您必须将该路径转换为 URL
define(["require"], function(require) {
var cssUrl = require.toUrl("./style.css");
});
关于javascript - Requirejs 无法解析路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19638544/