mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-15 01:59:57 +00:00
Simple HMR (previous setup does not work)
This commit is contained in:
@@ -12,5 +12,6 @@
|
|||||||
<link rel="manifest" href="/manifest.json">
|
<link rel="manifest" href="/manifest.json">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<script src="./index.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -14,12 +14,8 @@ if (process.env.NODE_ENV !== 'production') {
|
|||||||
// Enable support for React DevTools and some helpful console warnings:
|
// Enable support for React DevTools and some helpful console warnings:
|
||||||
require('preact/debug');
|
require('preact/debug');
|
||||||
|
|
||||||
// When an update to any module is received, re-import the app and trigger a full re-render:
|
// Full HMR may not be working due to https://github.com/parcel-bundler/parcel/issues/5016
|
||||||
module.hot.accept('./components/App', () => {
|
if (module.hot) {
|
||||||
// The linter doesn't like the capital A in App. It is wrong.
|
module.hot.accept();
|
||||||
// tslint:disable-next-line variable-name
|
}
|
||||||
import('./components/App').then(({ default: App }) => {
|
|
||||||
root = render(<App />, document.body, root);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user