@@ -5,7 +5,7 @@ import ejs from "ejs";
55type EjsRenderOptions = ejs . Options & { async ?: false } ;
66type EjsRenderOptionsFn = ( config : ResolvedConfig ) => EjsRenderOptions ;
77type ViteEjsPluginDataType = Record < string , any > | ( ( config : ResolvedConfig ) => Record < string , any > ) ;
8- type ViteEjsPluginOptions = { watchEjsFiles ?: boolean , ejs ?: EjsRenderOptions | EjsRenderOptionsFn } ;
8+ type ViteEjsPluginOptions = { ejs ?: EjsRenderOptions | EjsRenderOptionsFn } ;
99
1010/**
1111 * Vite Ejs Plugin Function
@@ -24,11 +24,6 @@ function ViteEjsPlugin(data: ViteEjsPluginDataType = {}, options?: ViteEjsPlugin
2424 return {
2525 name : "vite-plugin-ejs" ,
2626
27- config ( config ) {
28- // Add .ejs extension to watch files.
29- if ( options && options . watchEjsFiles ) WatchEjsFiles ( config ) ;
30- } ,
31-
3227 // Get Resolved config
3328 configResolved ( resolvedConfig ) {
3429 config = resolvedConfig ;
@@ -68,20 +63,4 @@ function ViteEjsPlugin(data: ViteEjsPluginDataType = {}, options?: ViteEjsPlugin
6863}
6964
7065
71- function WatchEjsFiles ( config : UserConfig ) {
72- // Add .ejs extension to watch files.
73- // get watch config
74- let watch = config . build ? config . build . watch : { } ;
75-
76- // if none is defined, set to empty object
77- if ( ! watch ) watch = { }
78- // check if watch.include is defined and if not, set to empty array
79- if ( ! watch . include ) watch . include = [ ] ;
80- // if watch.include is not an array then convert to array
81- if ( ! Array . isArray ( watch . include ) ) watch . include = [ watch . include ] ;
82-
83- // Add ejs files to watch list
84- watch . include . push ( "**/*.ejs" ) ;
85- }
86-
8766export { ViteEjsPlugin , ejs }
0 commit comments