vuejs / jsx-vue2

monorepo for Babel / Vue JSX related packages
https://jsx-vue2-playground.netlify.app/
1.47k stars 96 forks source link

vue extension file with jsx #180

Open githubtuxedo opened 3 years ago

githubtuxedo commented 3 years ago

.babelrc

{
  "presets": [
    // "@babel/preset-react",
    "@vue/babel-preset-jsx",
    ["@babel/preset-env"],
  ],
  "plugins": ["@babel/plugin-transform-runtime"],
  // "plugins": ["transform-vue-jsx", "transform-runtime"],
  "env": {
    "test": {
      "presets": ["@babel/preset-env"],
      "plugins": ["transform-es2015-modules-commonjs", "dynamic-import-node"]
    }
  }
}

.vue file

<template></template>
...
<script>
   method: {
      func(h, { node, data, store }): { return <span>test</span> }
   }
</script>

Err msg: Support for the experimental syntax 'jsx' isn't currently enabled

githubtuxedo commented 3 years ago

.package.json

"vue-loader": "^15.0.10",
"webpack": "^4.46.0",
        "@babel/plugin-syntax-jsx": "^7.0.0",
        "@babel/polyfill": "^7.12.1",

        "@babel/core": "^7.12.13",
        "@babel/plugin-proposal-class-properties": "^7.0.0",
        "@babel/plugin-proposal-decorators": "^7.0.0",
        "@babel/plugin-proposal-export-namespace-from": "^7.0.0",
        "@babel/plugin-proposal-function-sent": "^7.0.0",
        "@babel/plugin-proposal-json-strings": "^7.0.0",
        "@babel/plugin-proposal-numeric-separator": "^7.0.0",
        "@babel/plugin-proposal-throw-expressions": "^7.0.0",
        "@babel/plugin-syntax-dynamic-import": "^7.0.0",
        "@babel/plugin-syntax-import-meta": "^7.0.0",
        "@babel/plugin-transform-modules-commonjs": "^7.0.0",
        "@babel/plugin-transform-runtime": "^7.0.0",
        "@babel/preset-env": "^7.0.0",
        "@babel/preset-react": "^7.12.13",
        "@babel/register": "^7.0.0",
ablikim915 commented 2 years ago

Err msg: Support for the experimental syntax 'jsx' isn't currently enabled

I have same issue

baixiaoji commented 3 months ago

I have same issue