mirror of https://github.com/linkerd/linkerd2.git
21 lines
744 B
Cheetah
21 lines
744 B
Cheetah
// based on https://gist.github.com/necolas/1025811
|
|
(function(doc, script) {
|
|
let js,
|
|
fjs = doc.getElementsByTagName(script)[0],
|
|
add = function(url, id) {
|
|
if (doc.getElementById(id)) {return;}
|
|
js = doc.createElement(script);
|
|
js.src = url;
|
|
id && (js.id = id);
|
|
fjs.parentNode.insertBefore(js, fjs);
|
|
};
|
|
<% for (let chunk in htmlWebpackPlugin.files.js) { %>
|
|
<% if (compilation.compiler.outputFileSystem.constructor.name === 'MemoryFileSystem') { %>
|
|
add('http://localhost:8080/<%= htmlWebpackPlugin.files.js[chunk] %>');
|
|
<% } else { %>
|
|
let root = fjs.src.substring(0, fjs.src.indexOf("dist"));
|
|
add(root+'<%= htmlWebpackPlugin.files.js[chunk] %>');
|
|
<% } %>
|
|
<% } %>
|
|
}(document, 'script'));
|