File tree 4 files changed +7
-11
lines changed
packages/vite/src/node/plugins
playground/transform-plugin
4 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -175,9 +175,7 @@ export function assetPlugin(config: ResolvedConfig): Plugin {
175
175
// raw requests, read from disk
176
176
if ( rawRE . test ( id ) ) {
177
177
const file = checkPublicFile ( id , config ) || cleanUrl ( id )
178
- if ( config . command !== 'build' ) {
179
- this . addWatchFile ( file )
180
- }
178
+ this . addWatchFile ( file )
181
179
// raw query, read file and return as string
182
180
return {
183
181
code : `export default ${ JSON . stringify (
Original file line number Diff line number Diff line change @@ -380,7 +380,7 @@ export function cssPlugin(config: ResolvedConfig): Plugin {
380
380
moduleCache . set ( id , modules )
381
381
}
382
382
383
- if ( deps && ! isBuild ) {
383
+ if ( deps ) {
384
384
for ( const file of deps ) {
385
385
this . addWatchFile ( file )
386
386
}
Original file line number Diff line number Diff line change @@ -12,11 +12,11 @@ export function loadFallbackPlugin(): Plugin {
12
12
try {
13
13
const cleanedId = cleanUrl ( id )
14
14
const content = await fsp . readFile ( cleanedId , 'utf-8' )
15
- // this.addWatchFile(cleanedId)
15
+ this . addWatchFile ( cleanedId )
16
16
return content
17
17
} catch ( e ) {
18
18
const content = await fsp . readFile ( id , 'utf-8' )
19
- // this.addWatchFile(id)
19
+ this . addWatchFile ( id )
20
20
return content
21
21
}
22
22
} ,
Original file line number Diff line number Diff line change @@ -7,17 +7,15 @@ let transformCount = 1
7
7
const transformPlugin = {
8
8
name : 'transform' ,
9
9
load ( id ) {
10
- if ( id === file && typeof this . addWatchFile === 'function' ) {
10
+ if ( id === file ) {
11
11
// Ensure `index.js` is reloaded if 'plugin-dep-load.js' is changed
12
12
this . addWatchFile ( './plugin-dep-load.js' )
13
13
}
14
14
} ,
15
15
transform ( code , id ) {
16
16
if ( id === file ) {
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
- }
17
+ // Ensure `index.js` is reevaluated if 'plugin-dep.js' is changed
18
+ this . addWatchFile ( './plugin-dep.js' )
21
19
22
20
return `
23
21
// Inject TRANSFORM_COUNT
You can’t perform that action at this time.
0 commit comments