hard-source-webpack-plugin icon indicating copy to clipboard operation
hard-source-webpack-plugin copied to clipboard

Execution order issue with relay-compiler-webpack-plugin

Open dggc opened this issue 7 years ago • 1 comments

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

dggc avatar Mar 05 '18 19:03 dggc

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.

mzgoddard avatar Mar 06 '18 15:03 mzgoddard