Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

More fixups to module resolution - #189

Merged
Mohamed Hegazy (mhegazy) merged 4 commits into
moduleResolutionfrom
moduleResolution-patch2
Mar 22, 2016
Merged

Mohamed Hegazy (mhegazy) merged 4 commits into
moduleResolutionfrom
moduleResolution-patch2

Conversation

@DanielRosenwasser

Copy link
Copy Markdown
Member

No description provided.

Comment thread pages/Module Resolution.md Outdated
Use `--moduleResolution` to specify the module resolution strategy.
Possible values are [Classic](#classic) and [Node](#node).
The default if not specified is [Node](#node).
There are two possible module resolution strategies [Node](#node) and [Classic](#classic).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need colon after 'strategies'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done,

@sandersn

Copy link
Copy Markdown
Member

On the whole, I like the original better. It's less wordy and the examples are simpler. Links to the Node documentation should suffice to explain Node's exact algorithm.

Comment thread pages/Module Resolution.md Outdated
Moreover, a require for a [non-relative module name](#relative-vs-non-relative-module-imports) is resolved from a special folder named `node_modules`.
`node_modules` can be on the same level as the current file, or higher up in the directory chain.
Node.js will *walk up* the directory chain, inspecting the contents of `node_modules` looking for the module to load.
However, resolution for a [non-relative module name](#relative-vs-non-relative-module-imports) is performed little differently.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove 'little'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.


Following up our example above, in `/src/moduleA.js`, and a require statement `var x = require("moduleB");` will result in the following attempts:
Following up our example above, consider if `/foo/src/moduleA.js` instead used a non-relative path and had the import `var x = require("moduleB");`.
Node would then try to resolve `moduleB` to each of the locations until one worked.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node.js

@mhegazy

Copy link
Copy Markdown
Contributor

just use Node.js everywhere you have Node now for consistency.

Mohamed Hegazy (mhegazy) added a commit that referenced this pull request Mar 22, 2016
@mhegazy
Mohamed Hegazy (mhegazy) merged commit d590191 into moduleResolution Mar 22, 2016
@mhegazy
Mohamed Hegazy (mhegazy) deleted the moduleResolution-patch2 branch March 22, 2016 17:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants