rstackjs / rstackjs/rspack-plugin-react-refresh

`sockIntegration: 'whm'` may inject `webpack-hot-middleware/client` twice

Open
#16 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
20
Forks
13
Avg merge
2h 55m
Merged PRs (30d)
6

Description

If end-user provide webpack-hot-middleware/client explicitly in the entry. this plugin should skip to inject it.

Scenario
// `rspack.config.js`

export default {
    // ...

    entry: {
	    application: [
		    './src/app.js'
            'webpack-hot-middleware/client?overlay=false&quiet=true',
        ]
    },

    // ...
}

In this case, the output bundle be like below

// ...

function(__webpack_require__) {
var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId) }
__webpack_require__.O(0, ["common",], function() {
        return __webpack_exec__("./node_modules/@rspack/plugin-react-refresh/client/reactRefreshEntry.js"),
             __webpack_exec__("./node_modules/webpack-hot-middleware/client.js"),
             // ^ Injected by this plugin
             __webpack_exec__("./node_modules/@rspack/plugin-react-refresh/client/errorOverlayEntry.js"),
             __webpack_exec__("./src/app.js"),
             __webpack_exec__("./node_modules/webpack-hot-middleware/client.js?overlay=false&quiet=true");
             // ^ Provided by the config
      });
var __webpack_exports__ = __webpack_require__.O();

}
// ...
Prior art

https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/lib/index.js#L82-L98

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the sockIntegration: 'whm' handling and compare it with the prior-art implementation linked in the issue. Reproduce the rspack.config.js scenario with an explicit webpack-hot-middleware/client entry, then verify that the generated bundle contains only one client entry.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.