[add] init

This commit is contained in:
lideqin
2024-09-23 15:40:22 +08:00
parent 260e07ed2e
commit 67c0b01552
88 changed files with 33522 additions and 83 deletions
+35
View File
@@ -0,0 +1,35 @@
const glob = require('glob')
const pages = {};
module.exports.pages = function getPages() {
glob.sync('./src/pages/*/*.js').forEach((filepath) => {
const fileList = filepath.split('/')
const fileName = fileList[fileList.length - 2]
pages[fileName] = {
// entry: `src/pages/${fileName}/${fileName}.js`,
entry: `src/pages/${fileName}/index.js`,
// 模板来源
// template: `src/pages/${fileName}/${fileName}.html`,
template: 'public/index.html',
// 在 dist/index.html 的输出
filename: process.env.NODE_ENV === 'development' ? `${fileName}/index.html` : `${fileName}/index.html`,
// 提取出来的通用 chunk 和 vendor chunk。
chunks: ['chunk-vendors', 'chunk-common', fileName],
// favicon: '../favicon.ico'
}
})
return pages;
};
const configs = [];
module.exports.configs = function getConfigs() {
glob.sync('./src/pages/*/config.json').forEach((filepath) => {
const fileList = filepath.split('/')
const fileName = fileList[fileList.length - 2]
configs.push({
from: `src/pages/${fileName}/config.json`,
to: process.env.NODE_ENV === 'development' ? `${fileName}/config.json` : `${fileName}/config.json`
})
})
return configs;
};
Binary file not shown.