Skip to content

Commit 3dfce54

Browse files
committed
fix: revert #129
1 parent c58f209 commit 3dfce54

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lib/utils/injectRefreshLoader.js

+5-9
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,11 @@ function injectRefreshLoader(data, matchObject) {
2424
// Check to prevent double injection
2525
!data.loaders.find(({ loader }) => loader === resolvedLoader)
2626
) {
27-
// It is important to have inject loader before anything,
28-
// especially if runtime transforms (e.g. @babel/plugin-transform-runtime) are being used.
29-
// Runtime transforms might make use of cache mechanisms (e.g. WeakMaps) to handle imports,
30-
// so if we do things out of their loop,
31-
// we might risk referencing a different version of the same dependency in the runtime.
32-
// This in its worst form will break HMR referential equality checks,
33-
// making us bail out on every change.
34-
// e.g. React in the file will not be equal to React as consumed by react-refresh.
35-
data.loaders.push({
27+
// As we inject runtime code for each module,
28+
// it is important to run the injected loader after everything.
29+
// This way we can ensure that all code-processing have been done,
30+
// and we won't risk breaking tools like Flow or ESLint.
31+
data.loaders.unshift({
3632
loader: resolvedLoader,
3733
options: undefined,
3834
});

0 commit comments

Comments
 (0)