Skip to content

Commit

Permalink
Use publicPath for SW & Manifest paths (#323)
Browse files Browse the repository at this point in the history
* Make template.html use publicPath for manifest

* Adds __webpack_public_path__ to registration of sw.js

* Disable eslint for __webpack_public_path__
  • Loading branch information
lwakefield authored and lukeed committed Oct 11, 2017
1 parent 0057199 commit 52e9843
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/lib/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ if (process.env.NODE_ENV==='development') {
require('preact/devtools');
}
else if (process.env.ADD_SW && 'serviceWorker' in navigator && location.protocol === 'https:') {
navigator.serviceWorker.register('/sw.js');
// eslint-disable-next-line no-undef
navigator.serviceWorker.register(__webpack_public_path__ + 'sw.js');
}


Expand Down
2 changes: 1 addition & 1 deletion src/resources/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="manifest" href="/manifest.json">
<link rel="manifest" href="<%= htmlWebpackPlugin.files.publicPath %>manifest.json">
<% if (htmlWebpackPlugin.options.manifest.theme_color) { %>
<meta name="theme-color" content="<%= htmlWebpackPlugin.options.manifest.theme_color %>">
<% } %>
Expand Down

0 comments on commit 52e9843

Please sign in to comment.