Open 4refael opened 6 years ago
Confirm - I've just added h
manually to one of my render functions that made something work.
I believe this issue is a duplicate of this regression from last year: https://github.com/vuejs/babel-plugin-transform-vue-jsx/issues/65
@rellect does your babel.config.js includes Vue's babel preset ("presets": ["vue-app"]
) and the JSX plugin (plugins: ["transform-vue-jsx"]
) ? that would explain your issue since @vue/babel-preset-app already has the JSX plugin, so your project would try to inject h
two times into each render function.
@pera Not using the vue-app
preset, but just to test I tried to remove transform-vue-jsx
from the plugins and surprisingly it compiles with no errors. Not sure what's going on really..
I have the same question when I run my unit test while I run dev and build was normal. Thank to @rellect and @pera ' s advice. I checked my .babelrc and found there is a 'transform-vue-jsx' in the plugin option and another 'transform-vue-jsx' in env option => test => plugin. So I delete the 'transform-vue-jsx' declear in the env. And it works. it seems to two plugins will each declare the 'h' when auto inject. Hope this would help somebody in the same situation like me.
transform-vue-jsx'
I solve this problem with removing 'transform-vue-jsx' declear in the babel.config.js. But I can't figure it out
To confirm, I was hitting this issue too (vue cli 3).
I removed "@vue/babel-preset-jsx"
and left just "@vue/app"
in my babel config & now all appears to work as expected.
I am assuming @vue/app
now supports JSX and the docs have yet to be updated.
yeah, @vue/app
now supports JSX, removed transform-vue-jsx
, my project works okay too
Hi
So I just installed vue-jsx for the first time, and I'm trying to run the provided example code that demonstrates
h
auto-injection, just copy pasted it to my app.js fileThe above doesn't compile and produces an error:
Should note that it does work when I add
h
as an argument (render (h) {...}
). So guess it's a problem with the auto injection? Unless I'm doing something wrong here..