dev-client.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
  2. hotClient.subscribe(event => {
  3. /**
  4. * Reload browser when HTMLWebpackPlugin emits a new index.html
  5. *
  6. * Currently disabled until jantimon/html-webpack-plugin#680 is resolved.
  7. * https://github.com/SimulatedGREG/electron-vue/issues/437
  8. * https://github.com/jantimon/html-webpack-plugin/issues/680
  9. */
  10. // if (event.action === 'reload') {
  11. // window.location.reload()
  12. // }
  13. /**
  14. * Notify `mainWindow` when `main` process is compiling,
  15. * giving notice for an expected reload of the `electron` process
  16. */
  17. if (event.action === 'compiling') {
  18. document.body.innerHTML += `
  19. <style>
  20. #dev-client {
  21. background: #4fc08d;
  22. border-radius: 4px;
  23. bottom: 20px;
  24. box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  25. color: #fff;
  26. font-family: 'Source Sans Pro', sans-serif;
  27. left: 20px;
  28. padding: 8px 12px;
  29. position: absolute;
  30. }
  31. </style>
  32. <div id="dev-client">
  33. Compiling Main Process...
  34. </div>
  35. `
  36. }
  37. })