From ec4ca37b83fe1d42db2f3746c48fd22809103d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E6=B1=89=E6=88=90?= Date: Wed, 30 May 2018 16:06:50 +0800 Subject: [PATCH] enable reload when necessary (#493) --- index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index ffc7a40f..c2022f29 100644 --- a/index.js +++ b/index.js @@ -97,11 +97,16 @@ function Bankai (entry, opts) { }) // Insert nodes into the graph. + var documentDependencies = [ 'assets:list', 'manifest:bundle', 'styles:bundle', 'scripts:bundle' ] + + if (opts.reload) { + documentDependencies.push('reload:bundle') + this.graph.node('reload', reloadNode) + } this.graph.node('assets', assetsNode) - this.graph.node('documents', [ 'assets:list', 'manifest:bundle', 'styles:bundle', 'scripts:bundle', 'reload:bundle' ], documentNode) + this.graph.node('documents', documentDependencies, documentNode) this.graph.node('manifest', manifestNode) this.graph.node('scripts', scriptNode) - this.graph.node('reload', reloadNode) this.graph.node('service-worker', [ 'assets:list', 'styles:bundle', 'scripts:bundle', 'documents:list' ], serviceWorkerNode) this.graph.node('styles', [ 'scripts:style', 'scripts:bundle' ], styleNode)