@@ -17,7 +17,7 @@ import { Manifest } from '../Manifest'
17
17
import { EnvParser } from '../EnvParser'
18
18
import { HttpServer } from '../HttpServer'
19
19
20
- import { SERVER_ENTRY_FILE } from '../../config/paths'
20
+ import { ENV_FILES , SERVER_ENTRY_FILE } from '../../config/paths'
21
21
22
22
/**
23
23
* Exposes the API to watch project for compilition changes.
@@ -284,6 +284,12 @@ export class DevServer {
284
284
* New file added
285
285
*/
286
286
watcher . on ( 'add' , async ( { relativePath } ) => {
287
+ if ( ENV_FILES . includes ( relativePath ) ) {
288
+ this . logger . action ( 'create' ) . succeeded ( relativePath )
289
+ this . httpServer . restart ( )
290
+ return
291
+ }
292
+
287
293
const metaData = this . rcFile . getMetaData ( relativePath )
288
294
if ( ! metaData . metaFile ) {
289
295
return
@@ -301,6 +307,12 @@ export class DevServer {
301
307
* File changed
302
308
*/
303
309
watcher . on ( 'change' , async ( { relativePath } ) => {
310
+ if ( ENV_FILES . includes ( relativePath ) ) {
311
+ this . logger . action ( 'update' ) . succeeded ( relativePath )
312
+ this . httpServer . restart ( )
313
+ return
314
+ }
315
+
304
316
const metaData = this . rcFile . getMetaData ( relativePath )
305
317
if ( ! metaData . metaFile ) {
306
318
return
@@ -318,6 +330,12 @@ export class DevServer {
318
330
* File removed
319
331
*/
320
332
watcher . on ( 'unlink' , async ( { relativePath } ) => {
333
+ if ( ENV_FILES . includes ( relativePath ) ) {
334
+ this . logger . action ( 'delete' ) . succeeded ( relativePath )
335
+ this . httpServer . restart ( )
336
+ return
337
+ }
338
+
321
339
const metaData = this . rcFile . getMetaData ( relativePath )
322
340
if ( ! metaData . metaFile ) {
323
341
return
0 commit comments