babel-plugin-transform-vue-jsx icon indicating copy to clipboard operation
babel-plugin-transform-vue-jsx copied to clipboard

flow.js: Cannot resolve name React

Open belka-ew opened this issue 6 years ago • 0 comments

I'm using Flow with Vue and if I have a jsx template, I get an error.

Here is the code:

// @flow

export default {
  render (h: any) {
    return <section />
  }
}

The error is:

5:12 error Cannot resolve name React flowtype-errors/show-errors

I can fix it if by putting // @jsx h on the top of the file - but this solution is not ideal.

I did some research and @babel/plugin-transform-react-jsx supports pragmas in the babel.config.js like this:

{
  "plugins": [
    ["@babel/plugin-transform-react-jsx", {
      "pragma": "h"
    }]
  ]
}

And TypeScript seems to support similar pragmas in the .tsconfig.

Any way to fix it in Vue?

belka-ew avatar Mar 04 '19 20:03 belka-ew