babel-plugin-jsx-v-model icon indicating copy to clipboard operation
babel-plugin-jsx-v-model copied to clipboard

Broken with Babel 7

Open chrisvfritz opened this issue 7 years ago • 5 comments
trafficstars

I'm not sure if the bug is here or in babel-plugin-transform-vue-jsx, but trying to use v-model in Babel 7 results in this error:

This API has been removed. If you're looking for this functionality in Babel 7, you should import the '@babel/helper-module-imports' module and use the functions exposed  from that module, such as 'addNamed' or 'addDefault'.

  at File.addImport (node_modules/@babel/core/lib/transformation/file/file.js:112:11)
  at PluginPass.addImport (node_modules/@babel/core/lib/transformation/plugin-pass.js:30:22)
  at buildOpeningElementAttributes (node_modules/babel-plugin-transform-vue-jsx/index.js:182:25)
  at buildElementCall (node_modules/babel-plugin-transform-vue-jsx/index.js:116:17)
  at PluginPass.exit (node_modules/babel-plugin-transform-vue-jsx/index.js:20:26)
  at newFn (node_modules/@babel/traverse/lib/visitors.js:223:21)
  at NodePath._call (node_modules/@babel/traverse/lib/path/context.js:64:19)
  at NodePath.call (node_modules/@babel/traverse/lib/path/context.js:38:17)
  at NodePath.visit (node_modules/@babel/traverse/lib/path/context.js:108:8)
  at TraversalContext.visitQueue (node_modules/@babel/traverse/lib/context.js:135:18)

Possibly related to https://github.com/vuejs/babel-plugin-transform-vue-jsx/issues/112.

chrisvfritz avatar Feb 24 '18 19:02 chrisvfritz

It seems that's fixable. someone already posted a fixed fork for babel-plugin-transform-vue-jsx in the issue you linked to, and it looks pretty simple:

https://github.com/wietseva/babel-plugin-transform-vue-jsx/commit/1b9ebada45d7a365e7ba3803cdd22dce460bee6c

LinusBorg avatar Feb 26 '18 08:02 LinusBorg

Yep, sorry guys, I'll try to get https://github.com/vuejs/jsx done by the end of the week, will completely redo v-model and event modifiers and make that all a part of that monorepo.

nickmessing avatar Feb 26 '18 10:02 nickmessing

Woohoo! Thanks @nickmessing. 😄

chrisvfritz avatar Feb 26 '18 22:02 chrisvfritz

Any advance on this? For now this is my approach:

<div>
    <input type="text" onInput={e => this.firstName = e.target.value} value={this.firstName} />
    <Home firstName={this.firstName} />
</div>

sant123 avatar Apr 25 '18 19:04 sant123

It seems to me that this is still broken..

edit: Never mind, it looks like all is well if you follow @nickmessing 's link and also install https://github.com/vuejs/jsx

dmrickey avatar Jun 13 '19 18:06 dmrickey