Skip to content

Commit 99f833b

Browse files
committed
Add preload/prefetch per vue-hn (#1)
1 parent d38afc8 commit 99f833b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

template/index.html

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
<!-- Add to home screen for Windows -->
1818
<meta name="msapplication-TileImage" content="/static/img/icons/icon-144x144.png">
1919
<meta name="msapplication-TileColor" content="#000000">
20+
<% for (var chunk of webpack.chunks) {
21+
for (var file of chunk.files) {
22+
if (file.match(/\.(js|css)$/)) { %>
23+
<link rel="<%= chunk.initial?'preload':'prefetch' %>" href="<%= htmlWebpackPlugin.files.publicPath + file %>" as="<%= file.match(/\.css$/)?'style':'script' %>"><% }}} %>
2024
</head>
2125
<body>
2226
<div id="app">This is your fallback content in case JavaScript fails to load.</div>

0 commit comments

Comments
 (0)