2019-10-23 04:48:35 -04: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 09:00:13 -05:00
|
|
|
'/frontend/js/main/index.js'
|
2019-10-23 04:48:35 -04:00
|
|
|
)
|
|
|
|
if (fs.existsSync(entryPath)) {
|
|
|
|
acc.push(entryPath)
|
|
|
|
}
|
|
|
|
return acc
|
|
|
|
}, entryPoints)
|
|
|
|
}
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
module.exports = function () {
|
2019-10-23 04:48:35 -04:00
|
|
|
return {
|
2021-04-27 03:52:58 -04:00
|
|
|
code: entryPoints.map(entryPoint => `import '${entryPoint}'`).join('\n'),
|
2019-10-23 04:48:35 -04:00
|
|
|
}
|
|
|
|
}
|