Closed Bug 638249 Opened 14 years ago Closed 11 years ago

allow module resolving to make use of an index.js

Categories

(Add-on SDK Graveyard :: General, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 935109

People

(Reporter: smcarthur, Unassigned)

References

Details

For instance, if one simply requires the name of library, such as require('my-lib'), it would look for a module called "index.js" at the top level of "my-lib". It would be expect to work for requiring subfolders as well. Inspiration from http://nodejs.org/docs/v0.3.0/api.html#module-resolving-325
Priority: -- → P2
Target Milestone: --- → Future
We just added support for the "main" property in package.json, so if my-lib/package.json had a "main: 'index.js'" line, this might already work. We could consider making the package.json reader (packaging.py) look for an index.js and use it as a default value for 'main' if not already set. Copying Irakli since he knows a lot about these things.
Priority: P2 → P3
Target Milestone: Future → 1.3
(Pushing all open bugs to the --- milestone for the new triage system)
Target Milestone: 1.3 → ---
Like bug 910594, this is needed for node parity
Note, there is ambiguity in filenames versus directories with index.js in them: - - start.js - womp.js - womp - index.js In this example, if I were to do `require('./womp')` from `start.js`, node would return `womp.js`, not `womp/index.js` -- just a note for implementation
In Bug 935109, node-style lookups were implemented in toolkit/loader under the `isNative` flag, for when we roll out the new AOM/jpm changes, and all addons using these new features
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.