简体   繁体   English

为什么我的dojo modulePaths配置被忽略了?

[英]Why is my dojo modulePaths configuration being ignored?

I am trying to setup custom module paths in Dojo 1.6, however i cant seem to get the paths correct. 我试图在Dojo 1.6中设置自定义模块路径,但是我似乎无法使路径正确。 I keep receiving the following error.. it seems like the path doesn't get changed.. 我一直收到以下错误..似乎路径没有改变..

Error 错误

http://url/dojotest/dojo/myApp/base.js 404 (Not Found)

Directory Structure 目录结构

/var/www/html/dojotest
   /dojo
      /dijit
      /dojo
      /dojox
   /myApp
      base.js
  index.html

index.html 的index.html

<html>
<head>
   <title>Dojo Testing</title>
   <script src="dojo/dojo/dojo.js"></script>   
   <script>
   var djConfig = 
   {
      modulePaths : { 'myApp' : '../../myApp' }
   };
   dojo.require('myApp.base');
   </script>
</head>
<body>
   <div>Lala Testy test test</div>
</body>
</html>

base.js base.js

dojo.provide('myApp.base');

console.log('you found me!');

You need to set the djConfig before including the dojo.js script tag 您需要包含dojo.js脚本标记之前设置djConfig

<script>
var dojoConfig = {
    modulePaths : { 'myApp' : '../../myApp' }
};
</script>

<script src="dojo/dojo/dojo.js"></script>

<script>
dojo.require('myApp.base');
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM