@@ -52,20 +52,20 @@ a(id="entries-outputs")
52
52
We feed Webpack with one or more *entry* files and let it find and incorporate the dependencies that radiate from those entries.
53
53
In this example, we start from the application's root file, `src/app.ts`:
54
54
55
- + makeExample('webpack/ts-snippets/webpack.config.snippets.js ' , 'one-entry' , 'webpack.config.js (single entry)' )( format ="." )
55
+ + makeExample('webpack/ts-snippets/webpack.config.snippets.ts ' , 'one-entry' , 'webpack.config.js (single entry)' )( format ="." )
56
56
57
57
:marked
58
58
Webpack inspects that file and traverses its `import` dependencies recursively.
59
59
60
- + makeExample('webpack/ts-snippets/webpack.config.snippets.js ' , 'app-example' , 'src/app.ts' )( format ="." )
60
+ + makeExample('webpack/ts-snippets/webpack.config.snippets.ts ' , 'app-example' , 'src/app.ts' )( format ="." )
61
61
62
62
:marked
63
63
Here it sees that we're importing *@angular/core* so it adds that to its dependency list for (potential) inclusion in the bundle.
64
64
It opens *@angular/core* and follows _its_ network of `import` statements until it has build the complete dependency graph from `app.ts` down.
65
65
66
66
Then it **outputs** these files to the `app.js` _bundle file_ designated in configuration:
67
67
68
- + makeExample('webpack/ts-snippets/webpack.config.snippets.js ' , 'one-output' , 'webpack.config.js (single output)' )( format ="." )
68
+ + makeExample('webpack/ts-snippets/webpack.config.snippets.ts ' , 'one-output' , 'webpack.config.js (single output)' )( format ="." )
69
69
70
70
:marked
71
71
This `app.js` output bundle is a single JavaScript file that contains our application source and its dependencies.
@@ -77,7 +77,7 @@ a(id="entries-outputs")
77
77
78
78
We change the configuration so that we have two entry points, `app.ts` and `vendor.ts`:
79
79
80
- + makeExample('webpack/ts-snippets/webpack.config.snippets.js ' , 'two-entries' ,'webpack.config.js (two entries)' )( format ="." )
80
+ + makeExample('webpack/ts-snippets/webpack.config.snippets.ts ' , 'two-entries' ,'webpack.config.js (two entries)' )( format ="." )
81
81
:marked
82
82
Webpack constructs two separate dependency graphs
83
83
and emits *two* bundle files, one called `app.js` containing only our application code and
@@ -105,12 +105,12 @@ a(id="loaders")
105
105
We teach it to process such files into JavaScript with *loaders*.
106
106
Here we configure loaders for TypeScript and CSS:
107
107
108
- + makeExample('webpack/ts-snippets/webpack.config.snippets.js ' , 'loaders' , 'webpack.config.js (two entries)' )( format ="." )
108
+ + makeExample('webpack/ts-snippets/webpack.config.snippets.ts ' , 'loaders' , 'webpack.config.js (two entries)' )( format ="." )
109
109
110
110
:marked
111
111
As Webpack encounters `import` statements like these ...
112
112
113
- + makeExample('webpack/ts-snippets/webpack.config.snippets.js ' , 'imports' )( format ="." )
113
+ + makeExample('webpack/ts-snippets/webpack.config.snippets.ts ' , 'imports' )( format ="." )
114
114
115
115
:marked
116
116
... it applies the `test` RegEx patterns. When a pattern matches the filename, Webpack processes the file with the associated loader.
@@ -131,7 +131,7 @@ a(id="plugins")
131
131
Webpack has a build pipeline with well-defined phases.
132
132
We tap into that pipeline with plugins such as the `uglify` minification plugin:
133
133
134
- + makeExample('webpack/ts-snippets/webpack.config.snippets.js ' , 'plugins' )( format ="." )
134
+ + makeExample('webpack/ts-snippets/webpack.config.snippets.ts ' , 'plugins' )( format ="." )
135
135
136
136
a( id ="configure-webpack" )
137
137
.l-main-section
@@ -212,7 +212,7 @@ a(id="common-configuration")
212
212
:marked
213
213
Our app will `import` dozens if not hundreds of JavaScript and TypeScript files.
214
214
We _might_ write `import` statements with explicit extensions as in this example:
215
- + makeExample('webpack/ts-snippets/webpack.config.snippets.js ' , 'single-import' )( format ="." )
215
+ + makeExample('webpack/ts-snippets/webpack.config.snippets.ts ' , 'single-import' )( format ="." )
216
216
217
217
:marked
218
218
But most of our `import` statements won't mention the extension at all.
0 commit comments