Browse Source

6.7: use SystemJS as a client-side loader.

Frederic G. MARAND 5 years ago
parent
commit
108f1d89e2
2 changed files with 17 additions and 1 deletions
  1. 14 1
      index.html
  2. 3 0
      package.json

+ 14 - 1
index.html

@@ -54,7 +54,20 @@
         <div class="col-sm-offset-2 col-sm-10" id="messages"></div>
 
         <!--add script tags here-->
-        <script src="js/app.js"></script>
+        <script src="node_modules/systemjs/dist/system.js"></script>
+        <script>
+            System.config({
+              meta: {
+                format: 'cjs',
+              },
+              packages: {
+                '.': {
+                  defaultExtension: 'js'
+                }
+              },
+            });
+            System.import('./js/app.js');
+        </script>
     </div>
 </body>
 </html>

+ 3 - 0
package.json

@@ -1,6 +1,9 @@
 {
   "author": "Bruce Wilson",
   "description": "Simple math game built with TypeScript",
+  "dependencies": {
+    "systemjs": "~0.20"
+  },
   "devDependencies": {
     "http-server": "^0.9.0",
     "tslint": "^5.11.0",