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

Ignored an update to unaccepted module - No automatic page reloading with recent versions of webpack and react packages #398

Closed
samhuk opened this issue Feb 25, 2021 · 3 comments

Comments

@samhuk
Copy link

samhuk commented Feb 25, 2021

  • Operating System: Windows 10 + MacOS
  • Node Version: 15.8.0
  • NPM Version: 7.5.3
  • webpack Version: 5.24.2
  • webpack-hot-middleware Version: 2.25.0
  • webpack-dev-middleware Version: 4.1.0
  • react Version: 17.0.1
  • ts-loader Version: 8.0.17

All of these are the latest version as of writing (already tried to see if updating everything solved it).

Expected Behavior

No console warn, page automatically reloads upon code change

Actual Behavior

Console warn and page doesn't automatically reloads upon code change
image

Code

Basic react front-end app with typescript, using ts-loader for webpack. For example, here's a file i'm doing a code change to:

import React from 'react'

export const Header = ({ title }: any) => (
  <div className="header">{title}</div>
)

export default Header

Got my dev webpack config (this is a dev layer on-top of a base, but this contains all the relevant dev-related config like dev middleware stuff):

export const config: webpack.Configuration = webpackMerge(base, {
  mode: 'development',
  devtool: 'inline-source-map',
  entry: [
    'webpack-hot-middleware/client?reload=true&overlay=true',
  ],
  plugins: [
    new webpack.EnvironmentPlugin({ NODE_ENV: 'development' }),
    new webpack.HotModuleReplacementPlugin(),
  ],
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        options: { configFile: TS_LOADER_TS_CONFIG_FILE_PATH },
        loader: 'ts-loader',
        exclude: /node_modules/,
      },
    ],
  },
})

Got my expressjs server using dev and hot middlewares:

app
  // -- Webpack dev and hot middleware to enable webpack to serve client files with hot reloading
  .use(webpackDevMiddleware(webpackCompiler))
  .use(webpackHotMiddleware(webpackCompiler))

How Do We Reproduce?

Notes

This was working as-is in previous versions of the packages (webpack and react), so I think that something changed that has made them incompatible for hot-reloading (or at least auto refreshing the page). I've checked and checked again the webpack docs and v5 upgrade notes and there doesn't seem to be pretty much anything about what this error means, other than this obscure and uninformative API reference of the function where the error is coming from: https://webpack.js.org/api/hot-module-replacement/#apply

I've asked the question on https://gitter.im/webpack/webpack#, but that seems to have suffered an all-Q-no-A death.

@glenjamin
Copy link
Collaborator

thanks for the detailed report, I think this is the same as #390 and #391

@samhuk
Copy link
Author

samhuk commented Feb 25, 2021

Ah, definitely a dupe. At least i'm glad it's not something i've done 😂 thanks!

@glenjamin
Copy link
Collaborator

Closing in favour of #390

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants