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

fix: import react-refresh without depending on extension #576

Merged
merged 3 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/ReactRefreshEntry.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global __react_refresh_library__ */

const safeThis = require('core-js-pure/features/global-this.js');
const RefreshRuntime = require('react-refresh/runtime.js');
const safeThis = require('core-js-pure/features/global-this');
const RefreshRuntime = require('react-refresh/runtime');

if (process.env.NODE_ENV !== 'production') {
if (typeof safeThis !== 'undefined') {
Expand Down
2 changes: 1 addition & 1 deletion loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const {
const schema = require('./options.json');

const RefreshRuntimePath = require
.resolve('react-refresh/runtime.js')
.resolve('react-refresh')
.replace(/\\/g, '/')
.replace(/'/g, "\\'");

Expand Down
2 changes: 1 addition & 1 deletion sockets/WPSSocket.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global ʎɐɹɔosǝʌɹǝs */
const { ClientSocket } = require('webpack-plugin-serve/lib/client/ClientSocket.js');
const { ClientSocket } = require('webpack-plugin-serve/lib/client/ClientSocket');

/**
* Initializes a socket server for HMR for webpack-plugin-serve.
Expand Down
6 changes: 3 additions & 3 deletions test/jest-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* @return {string}
*/
function resolver(request, options) {
// This acts as a mock for `require.resolve('react-refresh/runtime.js')`,
// This acts as a mock for `require.resolve('react-refresh')`,
// since the current mocking behaviour of Jest is not symmetrical,
// i.e. only `require` is mocked but not `require.resolve`.
if (request === 'react-refresh/runtime.js') {
return 'react-refresh/runtime.js';
if (request === 'react-refresh') {
return 'react-refresh';
}

return options.defaultResolver(request, options);
Expand Down
Loading