Index: lib/build/web_components.dart |
diff --git a/lib/build/web_components.dart b/lib/build/web_components.dart |
index d1028b2b9b7e2023274fcaf7e8921665e0295078..a5bf002e7633c6cf7f5087f28575e567fdc3a988 100644 |
--- a/lib/build/web_components.dart |
+++ b/lib/build/web_components.dart |
@@ -32,10 +32,14 @@ Asset generateWebComponentsBootstrap(Resolver resolver, Transform transform, |
resolver, transform, scriptId, newScriptId, |
errorIfNotFound: false, plugins: plugins); |
- // Add all seen imports to the document. |
+ // Add all seen imports to the document, before the first dart script tag if |
+ // it exists. |
+ var dartScript = |
+ document.head.querySelector('script[type="application/dart"]'); |
for (var importPath in htmlImportRecorder.importPaths) { |
- document.head.append(new dom.Element.tag('link') |
- ..attributes = {'rel': 'import', 'href': importPath,}); |
+ var import = new dom.Element.tag('link') |
+ ..attributes = {'rel': 'import', 'href': importPath,}; |
+ document.head.insertBefore(import, dartScript); |
} |
return initializeBootstrap; |