From eeb36e083db5e1a499c270560d108b3b6a5f6ccc Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Mon, 9 Oct 2017 16:44:55 -0700 Subject: [PATCH] Check to see if bundle has been loaded already --- packages/metal-soy-bundle/gulpfile.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/metal-soy-bundle/gulpfile.js b/packages/metal-soy-bundle/gulpfile.js index c48d87c3..51b08c1a 100644 --- a/packages/metal-soy-bundle/gulpfile.js +++ b/packages/metal-soy-bundle/gulpfile.js @@ -23,7 +23,10 @@ gulp.task('build', function() { return gulp.src(dependencies) .pipe(concat('bundle.js')) .pipe(replace('var goog = goog || {};', 'var goog = this.goog || {};')) - .pipe(header('import \'metal-incremental-dom\';\n\n(function() {\nthis.CLOSURE_NO_DEPS = true;\nthis.goog = this.goog || {};\n\n')) + .pipe(header('import \'metal-incremental-dom\';\n\n(function() {\nthis.CLOSURE_NO_DEPS = true;\nthis.goog = this.goog || {};\n\n' + + 'if (this.__METAL_SOY_BUNDLE_LOADED__) {\n' + + ' return;\n' + + '}\n' + 'this.__METAL_SOY_BUNDLE_LOADED__ = true;\n\n')) .pipe(footer('\n\ngoog.loadModule(function() {\n' + ' goog.module(\'incrementaldom\');\n' + ' return IncrementalDOM;\n' +