Skip to content

Commit

Permalink
perf(plugin-vue-jsx): hoist variables (#9687)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz authored Aug 16, 2022
1 parent dfdbc59 commit d9eb6b9
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/plugin-vue-jsx/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ function vueJsxPlugin(options: Options = {}): Plugin {
let needHmr = false
let needSourceMap = true

const { include, exclude, babelPlugins = [], ...babelPluginOptions } = options
const filter = createFilter(include || /\.[jt]sx$/, exclude)

return {
name: 'vite:vue-jsx',

Expand Down Expand Up @@ -75,14 +78,6 @@ function vueJsxPlugin(options: Options = {}): Plugin {

async transform(code, id, opt) {
const ssr = opt?.ssr === true
const {
include,
exclude,
babelPlugins = [],
...babelPluginOptions
} = options

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

// use id for script blocks in Vue SFCs (e.g. `App.vue?vue&type=script&lang.jsx`)
Expand Down

0 comments on commit d9eb6b9

Please sign in to comment.