mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-13 17:27:09 +00:00
Adds an app skeleton. Still needs some work.
This commit is contained in:
27
config/client-boot.js
Normal file
27
config/client-boot.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import { h, render } from 'preact';
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// enable preact devtools
|
||||
require('preact/debug');
|
||||
}
|
||||
else if (process.env.ADD_SW && 'serviceWorker' in navigator && location.protocol === 'https:') {
|
||||
// eslint-disable-next-line no-undef
|
||||
navigator.serviceWorker.register(__webpack_public_path__ + 'sw.js');
|
||||
}
|
||||
|
||||
const interopDefault = m => m && m.default ? m.default : m;
|
||||
|
||||
let app = interopDefault(require('app-entry-point'));
|
||||
|
||||
if (typeof app === 'function') {
|
||||
let root = document.getElementById('app') || document.body.firstElementChild;
|
||||
|
||||
let init = () => {
|
||||
let app = interopDefault(require('app-entry-point'));
|
||||
root = render(h(app), document.body, root);
|
||||
};
|
||||
|
||||
if (module.hot) module.hot.accept('app-entry-point', init);
|
||||
|
||||
init();
|
||||
}
|
||||
Reference in New Issue
Block a user