Skip to content

Commit 4f30d88

Browse files
committed
fix: pass transfrom-plugin
1 parent 88c81b7 commit 4f30d88

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

playground/transform-plugin/vite.config.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ let transformCount = 1
77
const transformPlugin = {
88
name: 'transform',
99
load(id) {
10-
if (id === file) {
10+
if (id === file && typeof this.addWatchFile === 'function') {
1111
// Ensure `index.js` is reloaded if 'plugin-dep-load.js' is changed
1212
this.addWatchFile('./plugin-dep-load.js')
1313
}
1414
},
1515
transform(code, id) {
1616
if (id === file) {
17-
// Ensure `index.js` is reevaluated if 'plugin-dep.js' is changed
18-
this.addWatchFile('./plugin-dep.js')
17+
if (typeof this.addWatchFile === 'function'){
18+
// Ensure `index.js` is reevaluated if 'plugin-dep.js' is changed
19+
this.addWatchFile('./plugin-dep.js')
20+
}
1921

2022
return `
2123
// Inject TRANSFORM_COUNT

0 commit comments

Comments
 (0)