2019-10-23 08:48:35 +00:00
|
|
|
const fs = require('fs')
|
|
|
|
const path = require('path')
|
|
|
|
|
|
|
|
const MODULES_PATH = path.join(__dirname, './')
|
|
|
|
|
|
|
|
const entryPoints = []
|
|
|
|
if (fs.existsSync(MODULES_PATH)) {
|
|
|
|
fs.readdirSync(MODULES_PATH).reduce((acc, module) => {
|
|
|
|
const entryPath = path.join(
|
|
|
|
MODULES_PATH,
|
|
|
|
module,
|
2019-11-05 14:00:13 +00:00
|
|
|
'/frontend/js/main/index.js'
|
2019-10-23 08:48:35 +00:00
|
|
|
)
|
|
|
|
if (fs.existsSync(entryPath)) {
|
|
|
|
acc.push(entryPath)
|
|
|
|
}
|
|
|
|
return acc
|
|
|
|
}, entryPoints)
|
|
|
|
}
|
|
|
|
|
2021-04-14 13:17:21 +00:00
|
|
|
module.exports = function () {
|
2019-10-23 08:48:35 +00:00
|
|
|
return {
|
2021-04-27 07:52:58 +00:00
|
|
|
code: entryPoints.map(entryPoint => `import '${entryPoint}'`).join('\n'),
|
2019-10-23 08:48:35 +00:00
|
|
|
}
|
|
|
|
}
|