Simple HMR (previous setup does not work)

This commit is contained in:
Jason Miller
2020-08-12 18:18:49 -04:00
parent f2dcd6e246
commit 1da9e9d7db
2 changed files with 5 additions and 8 deletions

View File

@@ -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>

View File

@@ -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);
});
});
} }