Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async / await #124

Closed
dgpgdev opened this issue Apr 18, 2018 · 9 comments
Closed

Async / await #124

dgpgdev opened this issue Apr 18, 2018 · 9 comments
Labels
type: feature request Request to add a new feature

Comments

@dgpgdev
Copy link

dgpgdev commented Apr 18, 2018

we can't use async await by default with a custom components in doc

.vuepress
--components
----customcomponents.vue

async sendRequest(){
 const response = await axios.post(this.url, JSON.parse(this.$refs.requestBody.innerText))
  //do soomething
}

need a specific loader (babel i suppose).

Maybe a good thing to embed babel async await loader by default

@ulivz
Copy link
Member

ulivz commented Apr 18, 2018

VuePress used Buble whose support for Async/Await is still in code review: bublejs/buble#125.

@ulivz ulivz added the type: feature request Request to add a new feature label Apr 18, 2018
@dgpgdev
Copy link
Author

dgpgdev commented Apr 18, 2018

ok, i changed buble to babel into my fork. Hope coming soon :)

@yyx990803
Copy link
Member

yyx990803 commented Apr 18, 2018

You can also use chainWebpack to replace the loader used for js:

module.exports = {
  chainWebpack: config => {
    const jsRule = config.module.rule('js')
    jsRule.uses.delete('buble-loader')
    jsRule.use('babel-loader').loader('babel-loader')
  }
}

Then install babel-core, babel-loader etc. and configure it as usual.

@dgpgdev
Copy link
Author

dgpgdev commented Apr 19, 2018

done! hope buble implements async await soon :)

@ycmjason
Copy link
Contributor

@yyx990803 Just curious, is there any particular reason that we use buble? It seems to lack a lot of essential features, e.g. proper polyfills, async/await... etc.

@yyx990803
Copy link
Member

@ycmjason Because it's a lighter and faster default and produces a smaller bundle.

@ycmjason
Copy link
Contributor

@yyx990803 In an exchange of less-complete functionality 😞

@fritx
Copy link

fritx commented Apr 27, 2018

Cool, always trying different stuffs, waiting..

@ulivz
Copy link
Member

ulivz commented May 10, 2018

Supported by #336 and merged as 82cd8bd

@ulivz ulivz closed this as completed May 10, 2018
meteorlxy added a commit that referenced this issue Jun 17, 2021
…lose #124) (#125)

Co-authored-by: meteorlxy <meteor.lxy@foxmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request Request to add a new feature
Projects
None yet
Development

No branches or pull requests

5 participants