diff --git a/pages/Module Resolution.md b/pages/Module Resolution.md index 7bfd61c9e..105b762b1 100644 --- a/pages/Module Resolution.md +++ b/pages/Module Resolution.md @@ -42,33 +42,6 @@ A non-relative import can be resolved relative to `baseUrl`, or through path map They can also resolve to [ambient module declarations](./Modules.md#ambient-modules). Use non-relative paths when importing any of your external dependnecies. -## Wildcard module declarations - -Some module loaders such as [SystemJS](https://github.com/systemjs/systemjs/blob/master/docs/overview.md#plugin-syntax) -and [AMD](https://github.com/amdjs/amdjs-api/blob/master/LoaderPlugins.md) allow non-JavaScript content to be imported. -These typically use a prefix or suffix to indicate the special loading semantics. -Wildcard module declarations can be used to cover these cases. - -```ts -declare module "*!text" { - const content: string; - export default content; -} -// Some do it the other way around. -declare module "json!*" { - const value: any; - export default value; -} -``` - -Now you can import things that match `"*!text"` or `"json!*"`. - -```ts -import fileContent from "./xyz.txt!text"; -import data from "json!http://example.com/data.json"; -console.log(data, fileContent); -``` - ## Module Resolution Strategies There are two possible module resolution strategies: [Node](#node) and [Classic](#classic). diff --git a/pages/Modules.md b/pages/Modules.md index d049a5a53..f84edcda8 100644 --- a/pages/Modules.md +++ b/pages/Modules.md @@ -517,6 +517,33 @@ import x, {y} from "hot-new-module"; x(y); ``` +### Wildcard module declarations + +Some module loaders such as [SystemJS](https://github.com/systemjs/systemjs/blob/master/docs/overview.md#plugin-syntax) +and [AMD](https://github.com/amdjs/amdjs-api/blob/master/LoaderPlugins.md) allow non-JavaScript content to be imported. +These typically use a prefix or suffix to indicate the special loading semantics. +Wildcard module declarations can be used to cover these cases. + +```ts +declare module "*!text" { + const content: string; + export default content; +} +// Some do it the other way around. +declare module "json!*" { + const value: any; + export default value; +} +``` + +Now you can import things that match `"*!text"` or `"json!*"`. + +```ts +import fileContent from "./xyz.txt!text"; +import data from "json!http://example.com/data.json"; +console.log(data, fileContent); +``` + ### UMD modules Some libraries are designed to be used in many module loaders, or with no module loading (global variables).