This repository was archived by the owner on Oct 12, 2022. It is now read-only.
Repository navigation
More fixups to module resolution - #189
Merged
Mohamed Hegazy (mhegazy) merged 4 commits intoMar 22, 2016
Merged
Conversation
| 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). |
There was a problem hiding this comment.
need colon after 'strategies'
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. |
| 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. |
There was a problem hiding this comment.
remove 'little'
|
|
||
| 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. |
Contributor
|
just use |
Mohamed Hegazy (mhegazy)
added a commit
that referenced
this pull request
Mar 22, 2016
More fixups to module resolution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.