@@ -82,6 +82,7 @@ if you need to regenerate one of the files, you can use the following CLI comman
82
82
* ` php protected/yii webpack/generate-config ` : regenerate ` webpack-yii2.json `
83
83
* ` php protected/yii webpack/generate-package ` : regenerate ` package.json `
84
84
* ` php protected/yii webpack/generate-webpack ` : regenerate ` webpack.config.js `
85
+ * ` php protected/yii webpack/generate-generate-typescript-config ` : regenerate ` tsconfig.json `
85
86
86
87
### Sample application structure
87
88
@@ -121,13 +122,16 @@ The typical answer when running `php protected/yii webpack` would be :
121
122
122
123
* ** Generating webpack.config.js**
123
124
125
+ * ** Generating tsconfig.json**
126
+
124
127
Application structure with generated files will be
125
128
126
129
* * index.php*
127
130
* * composer.json*
128
131
* * package.json*
129
132
* * webpack-yii2.json*
130
133
* * webpack.config.js*
134
+ * * tsconfig.json*
131
135
* ** protected**
132
136
* * yii* (console script)
133
137
* ** assets**
@@ -198,13 +202,53 @@ When your assets are ready, you have to make sure following files are added to y
198
202
* ` package.json ` node package management
199
203
* ` webpack.config.js ` needed to run webpack
200
204
* ` webpack-yii2.json ` needed by webpack.config.js to define you app entry points and the target directories
205
+ * ` tsconfig.json ` needed by webpack.config.js to handle Typescript files
201
206
202
207
* ` <appdir>/assets/webpack/assets-catalog.json ` to let the webpack aware asset find the dist files
203
208
* ` <appdir>/assets/webpack/dist ` to keep the assets (they are not dynamically generated when asset is registered)
204
209
* ` <appdir>/assets/webpack/src ` because you want to keep your sources :-)
205
210
206
211
212
+ ### File ` webpack-yii2.json ` explained
213
+
214
+ ``` json
215
+ {
216
+ "sourceDir" : " protected\/ assets\/ webpack" ,
217
+ "entry" : {
218
+ "app" : " ./app.ts"
219
+ },
220
+ "commonBundles" : [
221
+ " manifest"
222
+ ],
223
+ "externals" : {
224
+
225
+ },
226
+ "subDirectories" : {
227
+ "sources" : " src" ,
228
+ "dist" : " dist"
229
+ },
230
+ "assets" : {
231
+ "styles" : " css" ,
232
+ "scripts" : " js"
233
+ },
234
+ "catalog" : " assets-catalog.json"
235
+ }
236
+ ```
207
237
238
+ #### Specific to yii2-webpack module
239
+
240
+ * ** sourceDir** relative path to the directory where assets will be managed
241
+ * ** subDirectories** subpath (in * < sourceDir >* ) of sources and distribution files
242
+ * ** assets** subpath (in * < sourceDir >/< subDirectories.dist >* ) of styles and scripts assets
243
+ * ** catalog** name of assets catalog, must be in synch with ` WebpackAssetBundle::$webpackAssetCatalog `
244
+
245
+ #### Mapped to Webpack vars
246
+
247
+ * ** entry** object syntax entry points [ Webpack entry documentation] ( https://webpack.js.org/concepts/entry-points/#object-syntax )
248
+ * ** commonBundles** explicit vendor chunk [ Webpack CommonChunkPlugin documentation] ( https://webpack.js.org/plugins/commons-chunk-plugin/#explicit-vendor-chunk )
249
+ * ** externals** object syntax externals [ Webpack externals documentation] ( https://webpack.js.org/configuration/externals/#object )
250
+
251
+
208
252
Contributing
209
253
------------
210
254
0 commit comments