Repository navigation
Add module resolution documentation - #181
Conversation
| { | ||
| "compilerOptions": { | ||
| "paths": { | ||
| "jquery": ["node_modules\jquery\dist\jquery.slim.min.js"] |
There was a problem hiding this comment.
escape backslashes in json
|
|
||
| ### Node | ||
|
|
||
| This resolution strategy attempts to *mimic* the [nodejs](https://nodejs.org/) module resolution mechanism at runtime. |
There was a problem hiding this comment.
Based on the node module documentation, the prose spelling of Node is "Node.js" not nodejs. I think it's easier to read in the middle of a sentence anyway.
There was a problem hiding this comment.
done,
Fix-ups prior to "Module Resolution Strategies"
| A non-relative import can be resolved relative to `baseUrl`, or through path mapping, which we'll cover below. | ||
| They can also resolve to ambient module declarations. | ||
| They can also resolve to [ambient module declarations](./Modules.md#ambient-modules). | ||
| Use non-relative paths when importing any of your external dependnecies. |
There was a problem hiding this comment.
typo: dependencies
|
👍 |
|
Any more comments Daniel Rosenwasser (@DanielRosenwasser) and Vladimir Matveev (@vladima)? |
|
|
||
| To understand what the steps the TS compiler will follow, it is important to shed some light on Node.js modules. | ||
| Node.js supports multiple ways to resolve the target of a call to `require`. | ||
| A relative module name in Node.js can resolve to: |
There was a problem hiding this comment.
Instead of the last two lines, I'd suggest:
Traditionally, imports in Node.js are performed as calls to a function called `require`.
Node will resolve the path given to `require` to one of three things:
There was a problem hiding this comment.
Should mention that it's a relative path
There was a problem hiding this comment.
done.
|
I'll send out a quick PR for my suggestions |
|
I had a fix ready to go out and when the page didn't submit correctly, I lost all my work. 😱 |
|
|
||
| #### How Node.js resolves modules | ||
|
|
||
| To understand what the steps the TS compiler will follow, it is important to shed some light on Node.js modules. |
There was a problem hiding this comment.
to understand what steps (delete 'the')
There was a problem hiding this comment.
done.
…cript-Handbook into moduleResolution
More fixups to module resolution
Add module resolution documentation
Add documentation for module resolution.