vuejs / babel-plugin-jsx

JSX for Vue 3
https://vue-jsx-explorer.netlify.app
MIT License
1.7k stars 143 forks source link

[BUG] Excluding a file will prevent it from still getting parsed as JSX causing errors #667

Closed whaaaley closed 10 months ago

whaaaley commented 10 months ago

🐛 Bug description

I have a use case where I have JSX that needs to be compiled but not by this plugin. When excluding this file, that includes JSX, that I want to parse with another plugin, it tries to parse the file as JS instead. But since the file includes JSX syntax, there's an error.

[vite] Internal server error: Failed to parse source for import analysis because the content contains invalid JS syntax. If you use tsconfig.json, make sure to not set jsx to preserve.

I need a way for this instance of Babel to ignore this excluded file, or at least if the file extension is JSX, continue to parse it as JSX and not JS.

📝 Steps to reproduce

Exclude a JSX file. It will throw an parsing error.

      vueJsx({
        exclude: /Editor\.jsx$/
      }),

Reproduction Link (required): I'll try to get one up asap

🏞 Desired result

^ Allow parsing of JSX independently after vueJsx

🚑 Other information

image