@@ -57,6 +57,7 @@ a(id="devenv")
57
57
* add a [tsconfig.json](#tsconfig) to guide the TypeScript compiler
58
58
* add a [typings.json](#typings) that identifies missing TypeScript definition files
59
59
* add a [package.json](#package-json) that defines the packages and scripts we need
60
+ * add a [systemjs.config.js](#systemjs) that configures system.js
60
61
* install the npm packages and typings files
61
62
62
63
a( id ="install-npm" )
@@ -318,12 +319,13 @@ code-example(format="").
318
319
+ makeExample('quickstart/ts/index.html' , null , 'index.html' )( format ="." )
319
320
.l-verbose-section
320
321
:marked
321
- There are three noteworthy sections of HTML
322
+ There are four noteworthy sections of HTML
322
323
323
324
1. The JavaScript [libraries](#libraries)
324
325
325
- 2. Configuration of [SystemJS](#systemjs) where we also import and run the
326
- `main` file that we just wrote. //TODO reword this a bit
326
+ 2. Configuration file for [SystemJS](#systemjs).
327
+
328
+ 3. Where we import and run the `main` file that we just wrote.
327
329
328
330
3. The [<my-app>](#my-app) tag in the `<body>` which is *where our app lives!*
329
331
@@ -333,21 +335,11 @@ code-example(format="").
333
335
We loaded the following scripts
334
336
+ makeExample('quickstart/ts/index.html' , 'libraries' , 'index.html' )( format ="." )
335
337
:marked
336
- We began with Internet Explorer polyfills.
337
- IE requires polyfills to run
338
- an application that relies on ES2015 promises and dynamic module loading.
339
- Most applications need those capabilities and most applications
340
- should run in Internet Explorer. //TODO es6-shim are not IE polyfills or they are?
338
+ We began with es6-shim which monkey patches the global context (window) with essential features of ES2015 (ES6).
341
339
342
340
Next are the polyfills for Angular2, `zone.js` and `reflect-metadata`.
343
341
344
342
Then the [SystemJS](#systemjs) library for module loading.
345
- .l-sub-section
346
- :marked
347
- Our QuickStart doesn't use the Reactive Extensions
348
- but any substantial application will want them
349
- when working with observables.
350
- We added the library here in QuickStart so we don't forget later.//TODO this subsection needs to be moved for when we cover the systemjs.config.js
351
343
:marked
352
344
We'll make different choices as we gain experience and
353
345
become more concerned about production qualities such as
@@ -374,12 +366,27 @@ code-example(format="").
374
366
With those cautions in mind, what are we doing in this QuickStart configuration?
375
367
+ makeExample('quickstart/ts/systemjs.config.1.js' , null , 'systemjs.config.js' )( format ="." )
376
368
:marked
369
+ First, we create a map to tell SystemJS where to look when we import some module.
370
+
371
+ Then, we give all our packages to SystemJS. That means all the project dependencies and our application package, `app`.
372
+
373
+ .l-sub-section
374
+ :marked
375
+ Our QuickStart doesn't use the Reactive Extensions
376
+ but any substantial application will want them
377
+ when working with observables.
378
+ We added the library here in QuickStart so we don't forget later.
379
+
380
+ :marked
381
+ The `app` package tells SystemJS what to do when it sees a request for a
382
+ module from the `app/` folder.
383
+
377
384
Our QuickStart makes such requests when one of its
378
385
application TypeScript files has an import statement like this:
379
386
+ makeExample('quickstart/ts/app/main.ts' , 'app-component' , 'main.ts (excerpt)' )( format ="." )
380
387
:marked
381
388
Notice that the module name (after `from`) does not mention a filename extension.
382
- The `packages:` configuration tells SystemJS to default the extension to 'js', a JavaScript file.
389
+ In the configuration we tell SystemJS to default the extension to 'js', a JavaScript file.
383
390
384
391
That makes sense because we transpile TypeScript to JavaScript
385
392
<i>before</i> running the application</a>.
0 commit comments