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

use webpack-hot-server-middleware with typescript #81

Closed
dagda1 opened this Issue Aug 18, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@dagda1

dagda1 commented Aug 18, 2018

Do you have any advice for using with typescript.

Currently my start command looks like this:

PORT=3600 NODE_ENV=development nodemon --watch 'src/server/**/*' -e ts,tsx --exec '../../node_modules/.bin/ts-node' ./src/index.ts

But this is obviously very costly as it does a hard restart when a file changes and involves compiling the webpack files each time.

@dagda1 dagda1 changed the title from use webpak-hot-server-middleware with typescript to use webpack-hot-server-middleware with typescript Aug 18, 2018

@richardscarrott

This comment has been minimized.

Member

richardscarrott commented Aug 28, 2018

I would recommend proxying to a custom dev-server for the SSR route(s) in development, e.g.

if (process.env.NODE_ENV === 'production') {
    const serverRenderer = require('../webpack/dist/server');
    app.use(serverRenderer());
} else {
    app.use(proxy('http://localhost:8080')); // Proxy to dev server which handles SSR w/ webpack-hot-server-middleware
}

app.listen(6060);
@richardscarrott

This comment has been minimized.

Member

richardscarrott commented Nov 15, 2018

@dagda1 I'm going to close this as I think the proxy solution is suitable -- feel free to continue the discussion here / reopen a new issue if you still have a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment