mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-20 02:35:53 +10:00
20 lines
364 B
JavaScript
20 lines
364 B
JavaScript
exports.pathsToModuleCode = function (files) {
|
|
let index = 0
|
|
let code = ''
|
|
|
|
code += files
|
|
.map(filePath => `import m${index++} from ${JSON.stringify(filePath)}`)
|
|
.join('\n')
|
|
|
|
code += '\n\nexport default [\n'
|
|
|
|
for (let i = 0; i < index; i++) {
|
|
code += ` m${i}`
|
|
code += i === index - 1 ? '\n' : ',\n'
|
|
}
|
|
|
|
code += ']\n'
|
|
|
|
return code
|
|
}
|