ModuleFolder
- MyModule.html
- require(["./MyModule"],function(MyModule){ new MyModule({},createDivInBody() ).startup(); }
- test/test.html
- require(["../MyModule"],function(MyModule){ new MyModule({},createDivInBody() ).startup(); }
- MyModule.js
- require(["dojo/text!./MyModule.html","AMD/cssI!./MyModule.css"],function( template, css) {... }
- MyModule.css
There are 2 bugs exposed in the code:
- The repative path in HTMLs is treated not as module with JS extension assumed but rather abstract resource, so no JS extension added when path converted to URL. What it could be if not a JS and why there is a difference to MID ?
- In CSS plugin the relative path is not working either. It is computated relatively to dojo basePath
- Shim the require() and rebase relative pathes with regard to existing basePath
- Create artificial "currentPage" package and place into require config, replace relative path dots with this package: require({paths:{currentPackage:location.href... }},["currentPackage/MyModule"]
- Use absolute package name: require(["lib/MyLib/PackageX/MyModule"
- give up on dojo and use another AMD loader
If there is a solution, please share.
Regards,
suns
PS. Thank Christophe Jolif's wisdom for this pain: https://bugs.dojotoolkit.org/ticket/14649
PPS. for interested will keep track on my blog.
No comments:
Post a Comment