Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(plugin-vue): avoid applying ref transform to dependencies by default
  • Loading branch information
yyx990803 committed Sep 6, 2021
1 parent e5b472d commit cd4f341
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
16 changes: 16 additions & 0 deletions packages/plugin-vue/README.md
Expand Up @@ -30,6 +30,22 @@ export interface Options {
*/
customElement?: boolean | string | RegExp | (string | RegExp)[]

/**
* Enable Vue ref transform (experimental).
* https://github.com/vuejs/vue-next/tree/master/packages/ref-transform
*
* **requires Vue \>= 3.2.5**
*
* - `true`: transform will be enabled for all vue,js(x),ts(x) files except
* those inside node_modules
* - `string | RegExp`: apply to vue + only matched files (will include
* node_modules, so specify directories in necessary)
* - `false`: disable in all cases
*
* @default false
*/
refTransform?: boolean | string | RegExp | (string | RegExp)[]

// options to pass on to @vue/compiler-sfc
script?: Partial<SFCScriptCompileOptions>
template?: Partial<SFCTemplateCompileOptions>
Expand Down
11 changes: 8 additions & 3 deletions packages/plugin-vue/src/index.ts
Expand Up @@ -58,9 +58,14 @@ export interface Options {

/**
* Enable Vue ref transform (experimental).
* https://github.com/vuejs/vue-next/tree/master/packages/ref-transform
*
* **requires Vue \>= 3.2.5**
* - `true`: transform will be enabled for all vue,js(x),ts(x) files
* - `string | RegExp`: apply to vue + only matched files
*
* - `true`: transform will be enabled for all vue,js(x),ts(x) files except
* those inside node_modules
* - `string | RegExp`: apply to vue + only matched files (will include
* node_modules, so specify directories in necessary)
* - `false`: disable in all cases
*
* @default false
Expand Down Expand Up @@ -97,7 +102,7 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin {
refTransform === false
? () => false
: refTransform === true
? createFilter(/\.(j|t)sx?$/)
? createFilter(/\.(j|t)sx?$/, /node_modules/)
: createFilter(refTransform)

// compat for older verisons
Expand Down

0 comments on commit cd4f341

Please sign in to comment.