react-refresh-webpack-plugin icon indicating copy to clipboard operation
react-refresh-webpack-plugin copied to clipboard

swc-loader much slower if react refresh plugin is enabled

Open piotrpalek opened this issue 3 years ago • 6 comments

Hey, I've tried integrating react fast refresh with swc-loader, and the result is that if I add new ReactRefreshPlugin() to the plugins: [] list in webpack, swc-loader is dog slow (well, as slow as if I was using babel). If I remove this plugin it's way faster, any ideas what could be wrong? Is this expected?

piotrpalek avatar Dec 16 '21 15:12 piotrpalek

Hey, I've tried integrating react fast refresh with swc-loader, and the result is that if I add new ReactRefreshPlugin() to the plugins: [] list in webpack, swc-loader is dog slow (well, as slow as if I was using babel). If I remove this plugin it's way faster, any ideas what could be wrong? Is this expected?

Can you share a bit more about your setup, or create a reproducible example? There have been performance fixes in the 0.5.x releases, but we do inject another loader into the bundling chain so maybe that would slow things down.

pmmmwh avatar Dec 25 '21 18:12 pmmmwh

Thanks for the info :)

Sorry if I'm light on details, but I'm still trying to come up with a reproducible example, and I can't share the whole repo since it's work related. I was asking to see if maybe this was known, could help me in research knowing where to look :)

I'll be hacking around and let you know if/when I manage to reproduce it or solve the issue

piotrpalek avatar Dec 26 '21 07:12 piotrpalek

Thanks for the info :)

Sorry if I'm light on details, but I'm still trying to come up with a reproducible example, and I can't share the whole repo since it's work related. I was asking to see if maybe this was known, could help me in research knowing where to look :)

I'll be hacking around and let you know if/when I manage to reproduce it or solve the issue

It could very much be due to source map generation, or if you have a lot of files that needs to be processed. Those are the two most likely points of clogging.

pmmmwh avatar Dec 26 '21 16:12 pmmmwh

Hi @piotrpalek did you find any solution? We are experiencing the same issue on a large project

marco2216 avatar Aug 31 '22 14:08 marco2216

@marco2216 no sorry :( for now we just didn't move to swc-loader

piotrpalek avatar Aug 31 '22 14:08 piotrpalek

@piotrpalek Feel free to try out if this change helps, I'm not actually sure if it has anything to do with swc-loader, but it significantly improved our transpile speed https://github.com/pmmmwh/react-refresh-webpack-plugin/pull/669

marco2216 avatar Sep 01 '22 14:09 marco2216