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