-
-
Notifications
You must be signed in to change notification settings - Fork 866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[with-typescript] Server HMR fails when entry file is .ts #420
Comments
+1 |
+1 |
have you tried the new razzle typescript plugin? |
+1 |
Problem is in index.ts file. I changed its code with following. (Razzle default index.js code). Now server HMR working. import http from 'http'
import app from './server'
const server = http.createServer(app)
let currentApp = app
server.listen(process.env.PORT || 3000, (error) => {
if (error) {
console.log(error)
}
console.log('🚀 started')
})
if (module.hot) {
console.log('✅ Server-side HMR Enabled!')
module.hot.accept('./server', () => {
console.log('🔁 HMR Reloading `./server`...')
server.removeListener('request', currentApp)
const newApp = require('./server').default
server.on('request', newApp)
currentApp = newApp
})
} |
Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal. |
ProBot automatically closed this due to inactivity. Holler if this is a mistake, and we'll re-open it. |
Hey, great work on razzle! I've developing on top of latest
with-typescript
, and noticed HMR on the server is broken.Steps to repro:
create-razzle-app --example with-typescript <name>
cd <name>
npm start
src/server.tsx
If you convert
src/index.ts
to .js, HMR works again. 🤔 (demo: https://github.com/markshlick/razzle-ts-hmr-demo/commit/dc476fdc3ba03a1b018b1f783dd3a0aea556fe1a).The text was updated successfully, but these errors were encountered: