0

I'm giving a try to scripted but I can't figure out how to tell the editor where my AMD modules are. Modules that are relative to the file currently being edited seem to resolve fine, but when I edit a file from a package that has dependencies on another package, the editor simply can't find them :

I have a dojo project with a structure like this : - web - index.php - js/src - dojo - dijit - dojox - mymodule - myWidget.js

And say if I put "dojo/dom" as a dependency of myWidget.js, the editor complains that it does not find the dojo/dom module.

Any ideas ?

Thanks.

Philippe

Philippe
  • 6,703
  • 3
  • 30
  • 50

1 Answers1

0

Scripted will try to 'discover' your AMD config by looking inside html files using some patterns.

The discovery algorithm looks for certain patterns. But the algorithm is a bit fragile in the sense that if your project doesn't match one of the patterns that we've implemented it will fail to find the configuration.

This is most likely what is happening for your project.

Are you able to provide a bit more details on your project strucuture?

Specifically, Scripted will start its discovery from an html file that loads requirejs. So to provide more specific information on why its failing on your project we'd need to know where that html file is in your project and how it loads requirejs and configures it.

If you want to see some examples of structures that work. There's some in the Scripted code-base test-resources. For example here's very basic one.

https://github.com/scripted-editor/scripted/tree/master/tests/server/test-resources/nested-web-with-scripts-folder/web-app

It has a html file called 'page.html' loads a 'main.js' script via a 'datamain' attribute in a script tag.

If your project looks like this, it should work, if it doesn't that's a bug. If it looks differently then its hard to say more without knowing about how you use requirejs in your project.

Kris
  • 3,898
  • 1
  • 23
  • 32
  • Thanks for the information. Actually my project is using dojo, not requirejs. Would it work if I put a dummy html page referencing dojo.js at the root of my js structure described above ? – Philippe Mar 06 '13 at 21:04
  • Using some kind of dummy requirejs setup will probably work though it might take a bit of trial and error to 'trick' scripted into finding your config. It would also be interesting to us (Scripted devs) to get an idea what your project looks like. Maybe we can come up with a 'pattern' we can detect so we actually find the config in your project and similar ones. – Kris Mar 07 '13 at 20:08
  • Actually it's not specific to my project layout. Any dojo problem with custom modules seems to have the same issue. For example, checkout dojo-boilerplate at https://github.com/csnover/dojo-boilerplate and try to open src/app/main.js, you will notice the warnings in the dependencies as in my example. – Philippe Mar 26 '13 at 14:26
  • Similarly, if you open a file in the dijit directory, all the references to modules outside that directory are not discovered... – Philippe Mar 26 '13 at 14:28