From 58ae9d4c8021ce1343ea28fdc31be07de526c5ea Mon Sep 17 00:00:00 2001 From: Mizok Date: Tue, 5 Apr 2022 00:27:30 +0800 Subject: [PATCH] update --- README.md | 2 +- webpack.config.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4b1fbd0..f4cc211 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ title: webpack-template date: author: Mizok -version: 0.5.0 +version: 0.5.1 tags: --- diff --git a/webpack.config.ts b/webpack.config.ts index 3a881d3..1b8d6ce 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -9,7 +9,7 @@ import 'webpack-dev-server'; // dont remove this import, it's for webpack-dev-se import HtmlWebpackPlugin from 'html-webpack-plugin'; const COMPRESS = false; -const getEntriesByParsingTemplateNames = (templatesFolderName)=>{ +const getEntriesByParsingTemplateNames = (templatesFolderName,atRoot = true)=>{ const folderPath = resolve(__dirname, `./src/${templatesFolderName}`); const entryObj: webpack.EntryObject = {}; const templateRegx = /(.*)(\.)(ejs|html)/g; @@ -20,9 +20,12 @@ const getEntriesByParsingTemplateNames = (templatesFolderName)=>{ if (entryName.match(entryRegex)) { entryName = entryName.replace(entryRegex, `$3`); } + + entryName= atRoot?entryName:`${templatesFolderName}/${entryName}` + let entryPath = resolve(__dirname, `src/ts/${entryName}.ts`); // entry stylesheet - let entryStyleSheetPath = resolve(__dirname, `./src/scss/${templatesFolderName}/${entryName}.scss`); + let entryStyleSheetPath = resolve(__dirname, `./src/scss/${entryName}.scss`); entryPath = fs.existsSync(entryPath)?entryPath:undefined; entryStyleSheetPath = fs.existsSync(entryStyleSheetPath)?entryStyleSheetPath:undefined; @@ -96,7 +99,6 @@ const config = (env:any,argv:any):webpack.Configuration=>{ devServer: { historyApiFallback: true, open: true, - host:'192.168.100.191', compress: true, watchFiles: [ 'src/pages/*.html',