[Dojo-interest] custom module path in 1.7.1

31 views
Skip to first unread message

Rice

unread,
Jan 8, 2012, 8:46:22 AM1/8/12
to dojo-i...@dojotoolkit.org
Hi,
I have a custom module xs.widget.Bar and I use it in a html file
like below,

dojo.require("xs.widget.Bar");

It is fetched correctly from http://localhost:8080/common/xs/widget/Bar.js
when running in source (not built) dojo 1.7.1. However, the url goes
wrong to http://localhost:8080/common/dojo/xs/widget/Bar.js with
'dojo' sit in the url when running in built dojo 1.7.1. My program
runs well both in built and not built dojo before 1.7. Any clue?

Rice

________________________________________________________
Dojotoolkit: http://dojotoolkit.org
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api
Tutorials: http://dojotoolkit.org/documentation

Dojo-i...@mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Ivar

unread,
Jan 8, 2012, 9:11:14 AM1/8/12
to dojo-i...@mail.dojotoolkit.org
Hi,

It is a bit hard to help your when you don't include a full example.
Are you sure that you have the same dojoConfig in bot scenarios. It is
this configuration that tells dojo where to find different modules.
Read more about it at:
http://dojotoolkit.org/documentation/tutorials/1.6/dojo_config/

And to your info:
dojo.require(..) is a legacy way to require dependencies, the new way
is to use the requireJS syntax:
require(["xs.widget.Bar"]);

http://dojotoolkit.org/features/1.6/async-modules

Best regards
Ivar Conradi Østhus

Rice

unread,
Jan 8, 2012, 9:41:30 AM1/8/12
to dojo-i...@dojotoolkit.org
Hi Ivar,
My code is like below

<script type="text/javascript" src="${common}/dojo/dojo.js"
dojoConfig="parseOnLoad: true, isDebug: true"></script>
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.require("dijit.Toolbar");
dojo.require("dijit.Menu");
dojo.require("dijit.MenuItem");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.TabContainer");
dojo.require("dojox.layout.ContentPane");
dojo.require("dijit.InlineEditBox");
dojo.require("xs.widget.Bar");

For both scenario, the dojoConfig is same. What is different is the
dojo I use on the server side. One is built dojo 1.7.1, the other is
non-built dojo 1.7.1.

Thanks,
Rice

On Jan 8, 10:11 pm, Ivar <ivarc...@gmail.com> wrote:
> Hi,
>
> It is a bit hard to help your when you don't include a full example.
> Are you sure that you have the same dojoConfig in bot scenarios. It is
> this configuration that tells dojo where to find different modules.
> Read more about it at:http://dojotoolkit.org/documentation/tutorials/1.6/dojo_config/
>
> And to your info:
> dojo.require(..) is a legacy way to require dependencies, the new way
> is to use the requireJS syntax:
> require(["xs.widget.Bar"]);
>
> http://dojotoolkit.org/features/1.6/async-modules
>
> Best regards
> Ivar Conradi Østhus
>

> On 8 January 2012 14:46, Rice <rice...@gmail.com> wrote:
>
> > Hi,
> >  I have a custom module xs.widget.Bar and I use it in a html file
> > like below,
>
> > dojo.require("xs.widget.Bar");
>

> > It is fetched correctly fromhttp://localhost:8080/common/xs/widget/Bar.js


> > when running in source (not built) dojo 1.7.1. However, the url goes
> > wrong tohttp://localhost:8080/common/dojo/xs/widget/Bar.jswith
> > 'dojo' sit in the url when running in built dojo 1.7.1. My program
> > runs well both in built and not built dojo before 1.7. Any clue?
>
> > Rice
>
> > ________________________________________________________
> > Dojotoolkit:http://dojotoolkit.org
> > Reference Guide:http://dojotoolkit.org/reference-guide
> > API Documentation:http://dojotoolkit.org/api
> > Tutorials:http://dojotoolkit.org/documentation
>

> > Dojo-inter...@mail.dojotoolkit.org


> >http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
> ________________________________________________________
> Dojotoolkit:http://dojotoolkit.org
> Reference Guide:http://dojotoolkit.org/reference-guide
> API Documentation:http://dojotoolkit.org/api
> Tutorials:http://dojotoolkit.org/documentation
>

> Dojo-inter...@mail.dojotoolkit.orghttp://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Ivar

unread,
Jan 8, 2012, 10:01:59 AM1/8/12
to dojo-i...@mail.dojotoolkit.org, dojo-i...@dojotoolkit.org
Hi again,

could you try to do:

//Where to find "xs"-package
dojo.registerModulePath("xs", "/xs");

dojo.require("dojo.parser");
dojo.require("dijit.Toolbar");
dojo.require("dijit.Menu");
dojo.require("dijit.MenuItem");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.TabContainer");
dojo.require("dojox.layout.ContentPane");
dojo.require("dijit.InlineEditBox");
dojo.require("xs.widget.Bar");

Best regards,

Ivar Conradi Østhus

Rice

unread,
Jan 8, 2012, 11:37:40 AM1/8/12
to dojo-i...@dojotoolkit.org
Hi Ivar,
xs is a sibling directory, /commons/xs, to the dojo directory, which
is /common/dojo, so I don't need to registerModulePath for xs. See
http://dojotoolkit.org/reference-guide/dojo/registerModulePath.html

Rice

On Jan 8, 11:01 pm, Ivar <ivarc...@gmail.com> wrote:
> Hi again,
>
> could you try to do:
>
> //Where to find "xs"-package
> dojo.registerModulePath("xs", "/xs");
>
> dojo.require("dojo.parser");
> dojo.require("dijit.Toolbar");
> dojo.require("dijit.Menu");
> dojo.require("dijit.MenuItem");
> dojo.require("dijit.layout.BorderContainer");
> dojo.require("dijit.layout.TabContainer");
> dojo.require("dojox.layout.ContentPane");
> dojo.require("dijit.InlineEditBox");
> dojo.require("xs.widget.Bar");
>
> Best regards,
>
> Ivar Conradi Østhus
>

Rice

unread,
Jan 8, 2012, 12:01:44 PM1/8/12
to dojo-i...@dojotoolkit.org
Hi Ivar,
I try
dojo.registerModulePath("xs", "/common/xs");

and it works. But based on documentation, /common/xs is a sibling
directory to /common/dojo, I should not need to call
registerModulePath.

Rice

On Jan 9, 12:37 am, Rice <rice...@gmail.com> wrote:
> Hi Ivar,

>   xs is a sibling directory, /commons/xs, to the dojo directory, which

> is /common/dojo, so I don't need to registerModulePath for xs. Seehttp://dojotoolkit.org/reference-guide/dojo/registerModulePath.html

Ivar

unread,
Jan 8, 2012, 3:50:10 PM1/8/12
to dojo-i...@mail.dojotoolkit.org, dojo-i...@dojotoolkit.org
On 8 January 2012 18:01, Rice <ric...@gmail.com> wrote:
> .. based on documentation, /common/xs is a sibling

> directory to /common/dojo, I should not need to call
> registerModulePath.

I agree! I have tested this myself and can verify the behavior you
describe. I guess this has to be a bug and should be fixed. You should
file a bug ticket for this issue.

Regards,
Ivar Conradi Østhus

Rice Yeh

unread,
Jan 9, 2012, 1:03:28 AM1/9/12
to dojo-i...@mail.dojotoolkit.org
Reply all
Reply to author
Forward
0 new messages