From 98953433369bd1af6f9a0ebfb6936c21f7a51a5d Mon Sep 17 00:00:00 2001 From: web-padawan Date: Fri, 4 May 2018 13:54:57 +0300 Subject: [PATCH] Remove no longer relevant usage of require.js stuff --- vaadin-development-mode-detector.html | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/vaadin-development-mode-detector.html b/vaadin-development-mode-detector.html index e2a6c77..ddc6aba 100644 --- a/vaadin-development-mode-detector.html +++ b/vaadin-development-mode-detector.html @@ -32,24 +32,17 @@ return htmlImports; } - function getEsModules() { - // native ES modules - const modules = document.querySelectorAll("script[type=module]"); - - // require.js modules - const require = document.querySelectorAll("script[data-requiremodule]"); - - return Array.from(modules).concat(Array.from(require)); - } - function isUnbundled() { if (useHtmlImports) { // If the app is bundled, then polymer.html should be included in some bundle and not in `polymer/polymer.html` const htmlImports = getHtmlImports(document, []); return htmlImports.filter(function(href) { return endsWith(href, "polymer/polymer-element.html")}).length > 0; } else { - const modules = getEsModules(); - return modules.filter(function (m) { return m.src.indexOf("vaadin-") > -1 }).length > 0; + const scripts = Array.from(document.querySelectorAll("script")); + // TODO(web-padawan): this is not expected to work for applications using native ES modules, + // since the index.html is unlikely to contain any direct imports of Vaadin components. + // It works with the AMD transform of CLI, as the