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

react refresh not work with injected require by other library #287

Closed
levinqdl opened this issue Dec 25, 2020 · 2 comments · Fixed by #290
Closed

react refresh not work with injected require by other library #287

levinqdl opened this issue Dec 25, 2020 · 2 comments · Fixed by #290

Comments

@levinqdl
Copy link

levinqdl commented Dec 25, 2020

I want to use linaria, which extracts css tag template into a css file and injects a require of the generated css at end of file. But react refresh can't work with it.

I've created a reproduce repo: https://github.com/levinqdl/refresh-reproduce.git

App.js transpiles to:

__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js");
__webpack_require__.$Refresh$.setup(module.id);




var App = function App() {
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", {
    className: "dm0as6w"
  }, "App1");
};

_c = App;
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (App);

__webpack_require__(/*! ../.linaria-cache/src/App.linaria.css */ "./.linaria-cache/src/App.linaria.css");

var _c;

__webpack_require__.$Refresh$.register(_c, "App");

const currentExports = __react_refresh_utils__.getModuleExports(module.id);
__react_refresh_utils__.registerExportsForReactRefresh(currentExports, module.id);

This issue should be related to #140 ,

webpack_require.$Refresh$.register is reseted by webpack_require of css file after webpack_require.$Refresh$.setup invoked.

@pmmmwh
Copy link
Owner

pmmmwh commented Dec 30, 2020

Thanks for the report, I will take a look and see if this is actually a regression

@pmmmwh
Copy link
Owner

pmmmwh commented Mar 1, 2021

Fixed in 0.5.0-beta.1.

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