diff --git a/rsbuild.config.ts b/rsbuild.config.ts index e39e567504b2106c44947b839e21a9bc287b70b5..6c90c9b3092b801ed2530163de4b9dc63b2b53e9 100644 --- a/rsbuild.config.ts +++ b/rsbuild.config.ts @@ -107,14 +107,18 @@ function getPages(pageList) { entry = `${communityModule}/${moduleName}/${filename}.js`; } else if (commercialModuleList.includes(filename)) { entry = `${commercialModule}/${moduleName}/${filename}.js`; - } - pages[filename] = { - entry, - template: `public/index.html`, - filename: `${filename}.html`, - title: pageLogin, - chunks: [`chunk-vendors`, `chunk-common`, filename] - }; + } + const entryPath = path.resolve(__dirname, entry); + const needEntry = glob.sync(entryPath); + if (needEntry.length > 0) { + pages[filename] = { + entry, + template: `public/index.html`, + filename: `${filename}.html`, + title: pageLogin, + chunks: [`chunk-vendors`, `chunk-common`, filename] + }; + } }); return pages; diff --git a/vue.config.js b/vue.config.js index 0a1b8c0be136702969b9a7047989d1f55b7d7bfd..705fcd993be8da509c15c85a167cb9a5931f841a 100755 --- a/vue.config.js +++ b/vue.config.js @@ -82,14 +82,18 @@ function getPages(pageList) { } else if (commercialModuleList.includes(filename)) { entry = `${commercialModule}/${moduleName}/${filename}.js`; } - newpage[filename] = { - entry: entry, - template: `public/index.html`, - filename: `${filename}.html`, - title: pageLogin, // 标题名称+参数 - chunks: [`chunk-vendors`, `chunk-common`, filename] - }; - Object.assign(pages, newpage); + const entryPath = path.resolve(__dirname, entry); + const needEntry = glob.sync(entryPath); + if (needEntry.length > 0) { + newpage[filename] = { + entry: entry, + template: `public/index.html`, + filename: `${filename}.html`, + title: pageLogin, // 标题名称+参数 + chunks: [`chunk-vendors`, `chunk-common`, filename] + }; + Object.assign(pages, newpage); + } }); } else { //eg:['process','dashboard']