vue-live icon indicating copy to clipboard operation
vue-live copied to clipboard

Transforming async functions is not implemented. Use `transforms: { asyncAwait: false }` to skip transformation and disable this error.

Open enodr opened this issue 2 years ago • 3 comments

Hi,

My template (SFC) has async functions but I get this error:

Transforming async functions is not implemented. Use transforms: { asyncAwait: false }to skip transformation and disable this error.

There seems to be a fix here https://github.com/vue-styleguidist/vue-styleguidist/issues/741 but I am confused as how I could force vue-live to use a custom styleguide.config.js config file or pass the option ?

enodr avatar Sep 30 '21 09:09 enodr

Also see regarding Buble: https://github.com/facebook/docusaurus/pull/3954

enodr avatar Sep 30 '21 09:09 enodr

Ok found out the solution which is super simple: we just need to pass the corresponding buble config in Preview.vue:

       const renderedComponent = compileScript(
          code,
          this.jsx
            ? { jsx: "__pragma__(h)", objectAssign: "__concatenate__", transforms: {asyncAwait: false}}
            : {transforms: {asyncAwait: false}}
        );

enodr avatar Sep 30 '21 10:09 enodr

THank you @enodr great research Would you make a quick PR?

elevatebart avatar Sep 30 '21 15:09 elevatebart

it seems to have been fixed...

https://github.com/vue-styleguidist/vue-live/blob/3c35891c367ea873834ec36105e9e2e64f511efd/src/Preview.vue#L137-L146

elevatebart avatar Nov 11 '22 22:11 elevatebart