xv
xv copied to clipboard
About dynamic runtime exports in CommonJS
let testCases = [ /* ... */ ]
/* works */
exports.testAll = async () => {
await Promise.all(testCases).map(async item => { /**/ })
}
/* runtime exports can't be recognized */
testCases.forEach(item => {
exports[item.xxx] = async () => { /* ... */ }
})
I'm consider a PR but not sure which would be the best approach:
- ignore this
- add a nextTick and display an explicit warning
- add a nextTick and recognize that for the user