Home

Issue: 874

Async in module.exports : "Cannot assign to read only property 'exports' of object '#<Object>'"

[issue link]

Hello !
Anyone know what’s wrong using async in Nuxt.js module.exports ?
This works well if i simply return a Promise without async & await stuff.

module.exports = {

  async getPosts (perPage = 10) {
    const {data} = await axios.get(endpoint + '/posts?_embed&per_page=' + perPage)
    return data
  }

}
This question is available on Nuxt.js community (#c747)