Skip to content

Commit

Permalink
remove check for "react" import
Browse files Browse the repository at this point in the history
  • Loading branch information
xandris committed Apr 8, 2020
1 parent e93e376 commit c66bda1
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ const RefreshModuleRuntime = Template.getFunctionContent(require('./RefreshModul
.replace(/^ {2}/gm, '')
.replace(/\$RefreshUtils\$/g, refreshUtils);

/** A token to match code statements similar to a React import. */
const reactModule = /['"]react['"]/;

/**
* A simple Webpack loader to inject react-refresh HMR code into modules.
*
Expand All @@ -22,8 +19,7 @@ function RefreshHotLoader(source, inputSourceMap) {
// Use callback to allow source maps to pass through
this.callback(
null,
// Only apply transform if the source code contains a React import
reactModule.test(source) ? source + '\n\n' + RefreshModuleRuntime : source,
source + '\n\n' + RefreshModuleRuntime,
inputSourceMap
);
}
Expand Down

0 comments on commit c66bda1

Please sign in to comment.