File tree Expand file tree Collapse file tree
packages/create-webpack-app/src/generators/init Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -151,7 +151,10 @@ export default async function reactInitGenerator(plop: NodePlopAPI) {
151151
152152 const files : FileRecord [ ] = [
153153 { filePath : "./index.html" , fileType : "text" } ,
154- { filePath : "webpack.config.js" , fileType : "text" } ,
154+ {
155+ filePath : answers . langType === "Typescript" ? "webpack.config.ts" : "webpack.config.js" ,
156+ fileType : "text" ,
157+ } ,
155158 { filePath : "package.json" , fileType : "text" } ,
156159 { filePath : "README.md" , fileType : "text" } ,
157160 { filePath : "./src/assets/webpack.png" , fileType : "binary" } ,
@@ -206,7 +209,9 @@ export default async function reactInitGenerator(plop: NodePlopAPI) {
206209 templateFile : join (
207210 plop . getPlopfilePath ( ) ,
208211 "../templates/init/react" ,
209- `${ file . filePath } .tpl` ,
212+ file . filePath . startsWith ( "webpack.config" )
213+ ? "webpack.config.tpl"
214+ : `${ file . filePath } .tpl` ,
210215 ) ,
211216 fileType : file . fileType ,
212217 data : answers ,
Original file line number Diff line number Diff line change @@ -143,7 +143,10 @@ export default async function svelteInitGenerator(plop: NodePlopAPI) {
143143 const files : FileRecord [ ] = [
144144 { filePath : "./index.html" , fileType : "text" } ,
145145 { filePath : "./src/assets/webpack.png" , fileType : "binary" } ,
146- { filePath : "webpack.config.js" , fileType : "text" } ,
146+ {
147+ filePath : answers . langType === "Typescript" ? "webpack.config.ts" : "webpack.config.js" ,
148+ fileType : "text" ,
149+ } ,
147150 { filePath : "package.json" , fileType : "text" } ,
148151 { filePath : "README.md" , fileType : "text" } ,
149152 { filePath : "./src/components/HelloWorld.svelte" , fileType : "text" } ,
@@ -193,7 +196,9 @@ export default async function svelteInitGenerator(plop: NodePlopAPI) {
193196 templateFile : join (
194197 plop . getPlopfilePath ( ) ,
195198 "../templates/init/svelte" ,
196- `${ file . filePath } .tpl` ,
199+ file . filePath . startsWith ( "webpack.config" )
200+ ? "webpack.config.tpl"
201+ : `${ file . filePath } .tpl` ,
197202 ) ,
198203 fileType : file . fileType ,
199204 data : answers ,
Original file line number Diff line number Diff line change @@ -155,7 +155,10 @@ export default async function vueInitGenerator(plop: NodePlopAPI) {
155155 const files : FileRecord [ ] = [
156156 { filePath : "./index.html" , fileType : "text" } ,
157157 { filePath : "./src/assets/webpack.png" , fileType : "binary" } ,
158- { filePath : "webpack.config.js" , fileType : "text" } ,
158+ {
159+ filePath : answers . langType === "Typescript" ? "webpack.config.ts" : "webpack.config.js" ,
160+ fileType : "text" ,
161+ } ,
159162 { filePath : "package.json" , fileType : "text" } ,
160163 { filePath : "README.md" , fileType : "text" } ,
161164 { filePath : "./src/App.vue" , fileType : "text" } ,
@@ -215,7 +218,9 @@ export default async function vueInitGenerator(plop: NodePlopAPI) {
215218 templateFile : join (
216219 plop . getPlopfilePath ( ) ,
217220 "../templates/init/vue" ,
218- `${ file . filePath } .tpl` ,
221+ file . filePath . startsWith ( "webpack.config" )
222+ ? "webpack.config.tpl"
223+ : `${ file . filePath } .tpl` ,
219224 ) ,
220225 fileType : file . fileType ,
221226 data : answers ,
You can’t perform that action at this time.
0 commit comments