Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle conversion of modules that were not required #32

Open
rmaccracken opened this issue Apr 5, 2013 · 2 comments
Open

Handle conversion of modules that were not required #32

rmaccracken opened this issue Apr 5, 2013 · 2 comments

Comments

@rmaccracken
Copy link

I'm not sure if this is already handled or not, but we had many cases where modules that were used in a file were not required in that file. We knew they were already required by the main app, so we just left them out. It would be nice if this conversion tool could fix such cases.

Take the following example:

dojo.provide("A.B");
dojo.require("A.C");
dojo.declare("A.B", A.C, {
foo: function() {
return A.D.bar();
}
});

So the question now is will A.D be converted properly? In our AMD conversion tool, we had a configuration file that included 3 columns:

  1. Old module - "A.D"
  2. Module ID - "A/D"
  3. Local variable name - "D"

This allowed the conversion tool to output the following:

require(["dojo/_base/declare","A/C","A/D"], function(declare,C,D) {
return declare(C, {
foo: function() {
return D.bar();
}
}
});

@neonstalwart
Copy link

@rmaccracken
Copy link
Author

Yes - if that is already working, then great. I guess I should have studied the examples a bit closer.

Is the logic such that it will find any references to global objects in the file (A.D.bar) and then see if it can find a corresponding file? In this case, it would look for "A/D/bar", and if it couldn't find such a file, then it would look for "A/D", and finally "A"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants