File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,11 @@ const DIST = 'assets/js/dist';
1111const banner = `/*!
1212 * ${ pkg . name } v${ pkg . version } | © ${ pkg . since } ${ pkg . author } | ${ pkg . license } Licensed | ${ pkg . homepage }
1313 */` ;
14-
1514const frontmatter = `---\npermalink: /:basename\n---\n` ;
16-
1715const isProd = process . env . BUILD === 'production' ;
1816
17+ let hasWatched = false ;
18+
1919function cleanup ( ) {
2020 fs . rmSync ( DIST , { recursive : true , force : true } ) ;
2121 console . log ( `> Directory "${ DIST } " has been cleaned.` ) ;
@@ -39,6 +39,11 @@ function build(
3939 { src = SRC_DEFAULT , jekyll = false , outputName = null } = { }
4040) {
4141 const input = `${ src } /${ filename } .js` ;
42+ const shouldWatch = hasWatched ? false : true ;
43+
44+ if ( ! hasWatched ) {
45+ hasWatched = true ;
46+ }
4247
4348 return {
4449 input,
@@ -49,9 +54,7 @@ function build(
4954 banner,
5055 sourcemap : ! isProd && ! jekyll
5156 } ,
52- watch : {
53- include : input
54- } ,
57+ ...( shouldWatch && { watch : { include : `${ SRC_DEFAULT } /**/*.js` } } ) ,
5558 plugins : [
5659 babel ( {
5760 babelHelpers : 'bundled' ,
You can’t perform that action at this time.
0 commit comments