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

How to using async/await with mobx ? [SLOVED 🎉 ] #333

Closed
cuduy197 opened this issue Aug 22, 2017 · 6 comments
Closed

How to using async/await with mobx ? [SLOVED 🎉 ] #333

cuduy197 opened this issue Aug 22, 2017 · 6 comments

Comments

@cuduy197
Copy link

I'm using mobx and i want to using async/await .
When i build it show error
capture

This is my async fn

captur2e

@reznord
Copy link
Member

reznord commented Aug 22, 2017

This doesn't seem like an issue with preact/preact-cli. Probably it is an error in your userStore.js

@cuduy197
Copy link
Author

@reznord i'm run in dev mode it work normal, but error when i build ?
Do i need config babel ?

@reznord
Copy link
Member

reznord commented Aug 22, 2017

Can you try running npm run build -- --no-prerender ?

Next time while opening an issue please follow the template.

@cuduy197
Copy link
Author

Yes, but it still error
It only work on development . 😕

@cuduy197
Copy link
Author

cuduy197 commented Aug 22, 2017

🎉 Yeah , i sloved this problem . 😄
Frist add yarn add babel-plugin-transform-runtime --dev
then config "preact.config.js"

 let Plugin = helpers.getLoadersByName(config, "babel-loader")[0].rule.options.plugins;
  //Enable async
  Plugin.push("transform-regenerator");
  Plugin.push([
    "transform-runtime",
    {
      helpers: false,
      polyfill: false,
      regenerator: true
    }
  ]);

Plz close this issue 🛩

@cuduy197 cuduy197 changed the title How to using async/await with mobx ? How to using async/await with mobx ? [SLOVED 👍 ] Aug 22, 2017
@cuduy197 cuduy197 changed the title How to using async/await with mobx ? [SLOVED 👍 ] How to using async/await with mobx ? [SLOVED 🎉 ] Aug 22, 2017
@HadrienPierart
Copy link

Man, this issue and its solution should definitely be somewhere in the docs... I've been pulling my hair off on this error : "regeneratorruntime is not defined" for the last couple hours and couldnt find a way to fix that with preact...
And now it seems to work fine again !
Thanks a lot cuduy197 (and the maintainers of preact too !)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants