xv icon indicating copy to clipboard operation
xv copied to clipboard

About dynamic runtime exports in CommonJS

Open fritx opened this issue 3 years ago • 0 comments

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:

  1. ignore this
  2. add a nextTick and display an explicit warning
  3. add a nextTick and recognize that for the user

fritx avatar Sep 23 '22 04:09 fritx