From e37f75a4fa1e8944b742771d95ed2bfffc69c31d Mon Sep 17 00:00:00 2001 From: LasaleFamine Date: Tue, 28 Nov 2017 21:10:56 +0100 Subject: [PATCH] feat(webcomponents-loader): re-added with correct logic --- src/index.html | 18 ++++++++++++++++++ webpack.config.js | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/src/index.html b/src/index.html index 36e11d9..aeb8577 100644 --- a/src/index.html +++ b/src/index.html @@ -70,6 +70,24 @@ } else { console.log('Service worker is not supported'); } + + document.addEventListener('WebComponentsReady', function componentsReady() { + document.removeEventListener('WebComponentsReady', componentsReady, false); + + var script = document.createElement('script'); + script.async = true + script.src = './bundle.js'; + script.setAttribute('nomodule', true); + + var scriptModule = document.createElement('script'); + scriptModule.async = true + scriptModule.src = './module.bundle.js'; + scriptModule.setAttribute('module', true); + + + var refScript = document.body.getElementsByTagName('script')[0]; + refScript.parentNode.insertBefore(script, refScript); + }, false); diff --git a/webpack.config.js b/webpack.config.js index 107eeb6..a42070a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -35,6 +35,10 @@ const copyStatics = { from: resolve('./node_modules/@webcomponents/webcomponentsjs/webcomponents-sd-ce.js'), to: join(outputPath, 'vendor'), flatten: true + }, { + from: resolve('./node_modules/@webcomponents/webcomponentsjs/webcomponents-hi-sd-ce.js'), + to: join(outputPath, 'vendor'), + flatten: true }, { from: resolve('./node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js'), to: join(outputPath, 'vendor'),