Skip to content

WHM support breaks projects that do not have it installed #45

@billyjanitsch

Description

@billyjanitsch

After upgrading to 0.2.0, I noticed the following error:

ERROR in ./node_modules/@pmmmwh/react-refresh-webpack-plugin/src/runtime/WHMEventSource.js
Module not found: Error: Can't resolve 'webpack-hot-middleware/client' in '[...]/node_modules/@pmmmwh/react-refresh-webpack-plugin/src/runtime'

I believe this is because webpack sees this require when bundling the injected runtime code:

const client = require('webpack-hot-middleware/client');

And therefore tries to resolve and bundle that module. This code path isn't taken when a WDS client has been injected, but webpack doesn't know this at bundle time. My project doesn't use WHM so that module doesn't exist on my machine.

As a temporary workaround, installing WHM (npm i -D webpack-hot-middleware) fixes the issue.

/cc @blainekasten

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions