elsassph / react-hot-ts

React hot reload for TypeScript and Webpack/ts-loader or fuse-box
27 stars 2 forks source link

Generted async method fails #8

Closed maxinteger closed 3 years ago

maxinteger commented 5 years ago

If the class has an async arrow function propery, the lib generate invalid code.

For example:

export default class Test2 extends React.Component {
    fn = async () => {
        return await new Promise((res) => res(1))
    };
}

generate the fallowing error:

Module parse failed: The keyword 'yield' is reserved (68:15)
You may need an appropriate loader to handle this file type.
|     Test2.prototype._hmr_fn = function () {
>         return yield new Promise(function (res) { return res(1); });
|     };
maxinteger commented 5 years ago

PR: #9

elsassph commented 5 years ago

Oh good catch.

elsassph commented 3 years ago

Fixed