Nuxt.js: async/await in nuxt.config.js

Created on 7 Jun 2017  路  3Comments  路  Source: nuxt/nuxt.js

I'm starting to do pretty advanced stuff in config.generate.routes and miss having async/await for control flow. Can I run the config through babel somehow?

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

Most helpful comment

Hi @jroxendal

You can use node 8 to use async/await in your nuxt.config.js file.

All 3 comments

@jroxendal If you want to have a chance doing some stuff before nuxt build, you may use modules.
There is no official documentation yet, but you may browse modules repo to get idea how they basically work.

modules/test.js

module.exports = function myModule(moduleOptions) {
  // You can access and modifiy options (nuxt.config.js) using this.options
  // You can even access nuxt instance using this.nuxt

  // If you want to do async things here, simply return a promise 
  // or use second callback argument of function
}

nuxt.config.js

modules : [
  '~/modules/test.js'
]

Hi @jroxendal

You can use node 8 to use async/await in your nuxt.config.js file.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danieloprado picture danieloprado  路  3Comments

msudgh picture msudgh  路  3Comments

o-alexandrov picture o-alexandrov  路  3Comments

pehbehbeh picture pehbehbeh  路  3Comments

surmon-china picture surmon-china  路  3Comments