Skip to content

Commit cd4f341

Browse files
committed
fix(plugin-vue): avoid applying ref transform to dependencies by default
1 parent e5b472d commit cd4f341

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

packages/plugin-vue/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,22 @@ export interface Options {
3030
*/
3131
customElement?: boolean | string | RegExp | (string | RegExp)[]
3232

33+
/**
34+
* Enable Vue ref transform (experimental).
35+
* https://github.com/vuejs/vue-next/tree/master/packages/ref-transform
36+
*
37+
* **requires Vue \>= 3.2.5**
38+
*
39+
* - `true`: transform will be enabled for all vue,js(x),ts(x) files except
40+
* those inside node_modules
41+
* - `string | RegExp`: apply to vue + only matched files (will include
42+
* node_modules, so specify directories in necessary)
43+
* - `false`: disable in all cases
44+
*
45+
* @default false
46+
*/
47+
refTransform?: boolean | string | RegExp | (string | RegExp)[]
48+
3349
// options to pass on to @vue/compiler-sfc
3450
script?: Partial<SFCScriptCompileOptions>
3551
template?: Partial<SFCTemplateCompileOptions>

packages/plugin-vue/src/index.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ export interface Options {
5858

5959
/**
6060
* Enable Vue ref transform (experimental).
61+
* https://github.com/vuejs/vue-next/tree/master/packages/ref-transform
62+
*
6163
* **requires Vue \>= 3.2.5**
62-
* - `true`: transform will be enabled for all vue,js(x),ts(x) files
63-
* - `string | RegExp`: apply to vue + only matched files
64+
*
65+
* - `true`: transform will be enabled for all vue,js(x),ts(x) files except
66+
* those inside node_modules
67+
* - `string | RegExp`: apply to vue + only matched files (will include
68+
* node_modules, so specify directories in necessary)
6469
* - `false`: disable in all cases
6570
*
6671
* @default false
@@ -97,7 +102,7 @@ export default function vuePlugin(rawOptions: Options = {}): Plugin {
97102
refTransform === false
98103
? () => false
99104
: refTransform === true
100-
? createFilter(/\.(j|t)sx?$/)
105+
? createFilter(/\.(j|t)sx?$/, /node_modules/)
101106
: createFilter(refTransform)
102107

103108
// compat for older verisons

0 commit comments

Comments
 (0)