hard-source-webpack-plugin
hard-source-webpack-plugin copied to clipboard
Execution order issue with relay-compiler-webpack-plugin
Hello, and first of, thanks to all the contributors for this awesome plugin.
I've been using it together with the Relay Webpack Plugin, which is responsible for compiling relay queries into Javascript files.
However, it seems that the Hardsource plugin executes before the relay plugin, generating an invalid bundle if it updates any files. To fix it, I have to run the webpack packing cycle twice to guarantee the Hardsource plugin sees any files updated by the relay plugin.
Is there any way to force the hardsource plugin to execute after the relay compiler plugin?
Thanks, Daniel
Hey @dggc, the file stating and hashing that hard-source relies on for invalidating modules is currently done on the run compiler plugin hooks. If relay plugin uses the same run hook you could order the plugins for relay to be ahead of hard-source.
This works at the same time as the normal CachePlugin. Difference being the CachePlugin only does file stating when webpack rebuilds and not on the initial build like hard-source. Does relay plugin not rebuild when webpack is watching the file system?
Other than that, the file stating and hashing will likely move soon to be done when a cached module is being thawed.