Skip to content
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

Request stuck when using hmr #68

Open
DiFuks opened this issue Dec 14, 2020 · 1 comment
Open

Request stuck when using hmr #68

DiFuks opened this issue Dec 14, 2020 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@DiFuks
Copy link

DiFuks commented Dec 14, 2020

The first request to localhost:3000 works correctly. But after modifying any of the files and rebuilding using webpack hmr, the page stops responding. The request stuck in the "pending" status

webpack.config.js

const webpack = require('webpack');
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const { TsconfigPathsPlugin } = require('tsconfig-paths-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const { RunScriptWebpackPlugin } = require('run-script-webpack-plugin');

module.exports = {
  entry: ['webpack/hot/poll?100', './src/server/main.ts'],
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'server.js',
  },
  watch: true,
  target: 'node',
  externals: [
    nodeExternals({
      allowlist: ['webpack/hot/poll?100'],
    }),
  ],
  module: {
    rules: [
      {
        test: /.tsx?$/,
        loader: 'ts-loader',
        exclude: /node_modules/,
      },
    ],
  },
  mode: 'development',
  resolve: {
    extensions: ['.tsx', '.ts', '.js'],
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new RunScriptWebpackPlugin({
      name: 'server.js',
    }),
  ],
};

IndexController:

import { Controller, Get, Render } from '@nestjs/common';

@Controller()
export class IndexController {
  @Get('/')
  @Render('Index')
  public get(): void {}
}
@kyle-mccarthy
Copy link
Owner

I actually don't have any experience with using HMR along with nest. If you resolve this issue, I would appreciate it if you could provide a solution for any future readers!

@kyle-mccarthy kyle-mccarthy added the help wanted Extra attention is needed label Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants