Browse Source

6.6: configuring module resolution.

Frederic G. MARAND 5 years ago
parent
commit
34e5012d97
2 changed files with 60 additions and 1 deletions
  1. 5 1
      app/tsconfig.json
  2. 55 0
      doc/modules.md

+ 5 - 1
app/tsconfig.json

@@ -3,7 +3,11 @@
   "compilerOptions": {
     "removeComments": true,
     // outFile is not compatible with all module loaders, including CommonJS
-    "module": "commonjs"
+    "module": "commonjs",
+    // module: commonjs -> moduleResolution: node, just make it explicit
+    "moduleResolution": "node",
+    // Debug helper
+    "traceResolution": true
   },
   "files": [
     "app.ts"

+ 55 - 0
doc/modules.md

@@ -0,0 +1,55 @@
+# Résolution des modules
+## "Classic"
+### "./person" dans /Source/Multimath/player.ts
+
+1. `/Source/Multimath/person.ts`
+1. `/Source/Multimath/person.d.ts` (type definition file)
+
+### "person" dans /Source/Multimath/player.ts
+
+1. `/Source/Multimath/person.ts`
+1. `/Source/Multimath/person.d.ts`
+1. `/Source/person.ts`
+1. `/Source/person.d.ts`
+1. `/person.ts`
+1. `/person.d.ts`
+
+## "Node"
+### "./person" dans /Source/Multimath/player.ts
+
+1. `/Source/Multimath/person.ts`
+1. `/Source/Multimath/person.tsx` (equivalent de JSX en TS)
+1. `/Source/Multimath/person.d.ts` (type definition file)
+1. `/Source/Multimath/person/package.json`: s'il existe une propriété `typings` pointant vers un fichier, l'utiliser
+1. `/Source/Multimath/index.ts`
+1. `/Source/Multimath/index.tsx`
+1. `/Source/Multimath/index.d.ts`
+
+
+### "person" dans /Source/Multimath/player.ts
+
+1. `/Source/Multimath/node_modules/person.ts`
+1. `/Source/Multimath/node_modules/person.tsx`
+1. `/Source/Multimath/node_modules/person.d.ts`
+1. `/Source/Multimath/node_modules/person/package.json#typings` (?)
+1. `/Source/Multimath/node_modules/@types/*ts[x]` (?)
+1. `/Source/Multimath/node_modules/index.ts`
+1. `/Source/Multimath/node_modules/index.tsx`
+1. `/Source/Multimath/node_modules/index.d.ts`
+1. `/Source/node_modules/person.ts`
+1. `/Source/node_modules/person.tsx`
+1. `/Source/node_modules/person.d.ts`
+1. `/Source/node_modules/person/package.json#typings`
+1. `/Source/node_modules/@types/*ts[x]` (?)
+1. `/Source/node_modules/index.ts`
+1. `/Source/node_modules/index.tsx`
+1. `/Source/node_modules/index.d.ts`
+1. `/node_modules/person.ts`
+1. `/node_modules/person.tsx`
+1. `/node_modules/person.d.ts`
+1. `/node_modules/person/package.json#typings`
+1. `/node_modules/@types/*ts[x]` (?)
+1. `/node_modules/index.ts`
+1. `/node_modules/index.tsx`
+1. `/node_modules/index.d.ts`
+1. Then start again with `.js` extension instead of `.ts[x]`.