question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When using Vue 3, a compilation error occurred in <></> in tsx

See original GitHub issue

Configuration used in the plugin

plugins: [
    vueJsx(),
    esbuild({ 
      jsxFactory: 'vueJsxCompat',
     }),
    vue(),
]

Use in code

const CardContainer = defineComponent({
    setup(props) {
      return () => <> text </>
    }
})

Compiled results

const CardContainer = defineComponent({
      setup(props2) {
        return () => /* @__PURE__ */ vueJsxCompat(React.Fragment, null, " text ");
      }
});

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
xxholly32commented, Aug 20, 2021

vue created official transform library

try

const vueJsx = require("@vitejs/plugin-vue-jsx");
const esbuild = require("rollup-plugin-esbuild");

export default {
  ... 
  plugins: [vueJsx(), esbuild()],
};
0reactions
RanxinStartcommented, Jan 10, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does vue fail to recognize TS syntax on the first ...
ERROR Failed to compile with 1 errors 3:54:55 PM error in ./src/components/ATSText/TextDate.vue Module Error (from ./node_modules/eslint-loader/ ...
Read more >
ts-loader - npm
TypeScript: 3.6.3+; webpack: 5.x+ (please use ts-loader 8.x if ... The build should fail on TypeScript compilation errors as of webpack 2.
Read more >
TypeScript Programming with Visual Studio Code
Another option is to install the TypeScript compiler locally in your project ( npm install --save-dev typescript ) and has the benefit of...
Read more >
Using Vue with TypeScript - Vue.js
This reduces the chance of runtime errors in production, and also allows us to ... If you have Vetur currently installed, make sure...
Read more >
Compiling Vue 3 from scratch and trying the new Composition ...
Try Vue 3 RIGHT NOW — by compiling it from scratch using the ... to get static typechecking on our templates, like in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found