Skip to content

Commit b0dc031

Browse files
committed
move run to beforeCompile hook and use the current contextModuleFactory
1 parent 9fd4141 commit b0dc031

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

plugins/react-server-dom-webpack-plugin.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,14 @@ export default class ReactFlightWebpackPlugin {
107107

108108
let clientFileNameFound = false;
109109

110-
function run (_params, callback) {
111-
// First we need to find all client files on the file system. We do this early so
112-
// that we have them synchronously available later when we need them. This might
113-
// not be needed anymore since we no longer need to compile the module itself in
114-
// a special way. So it's probably better to do this lazily and in parallel with
115-
// other compilation.
110+
compiler.hooks.beforeCompile.tapAsync(PLUGIN_NAME, ({contextModuleFactory}, callback) => {
116111
const contextResolver = compiler.resolverFactory.get('context', {});
117112

118113
_this.resolveAllClientFiles(
119114
compiler.context,
120115
contextResolver,
121116
compiler.inputFileSystem,
122-
compiler.createContextModuleFactory(),
117+
contextModuleFactory,
123118
function(err, resolvedClientRefs) {
124119
if (err) {
125120
callback(err);
@@ -130,11 +125,8 @@ export default class ReactFlightWebpackPlugin {
130125
callback();
131126
}
132127
);
133-
};
134-
135-
compiler.hooks.run.tapAsync(PLUGIN_NAME, run);
136-
137-
compiler.hooks.watchRun.tapAsync(PLUGIN_NAME, run);
128+
});
129+
138130

139131
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, function(compilation: Compilation, {normalModuleFactory}) {
140132
compilation.dependencyFactories.set(

0 commit comments

Comments
 (0)