Skip to content

Commit

Permalink
fix(vue-jsx): support jsx imports with queries (#7121)
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqunjiang authored Feb 28, 2022
1 parent 7c7dea2 commit 09e7eb1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/plugin-vue-jsx/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,13 @@ function vueJsxPlugin(options = {}) {
} = options

const filter = createFilter(include || /\.[jt]sx$/, exclude)
const [filepath] = id.split('?')

if (filter(id)) {
// use id for script blocks in Vue SFCs (e.g. `App.vue?vue&type=script&lang.jsx`)
// use filepath for plain jsx files (e.g. App.jsx)
if (filter(id) || filter(filepath)) {
const plugins = [importMeta, [jsx, babelPluginOptions], ...babelPlugins]
if (id.endsWith('.tsx')) {
if (id.endsWith('.tsx') || filepath.endsWith('.tsx')) {
plugins.push([
require('@babel/plugin-transform-typescript'),
// @ts-ignore
Expand Down

0 comments on commit 09e7eb1

Please sign in to comment.