I have a webpack project that contains multiple js & css files, I have css loader already set up and mini extract css plugin that outputs the css to a file. I need to get the content of the outputted css file in the runtime into a variable.
Why: I'm using cloudflare workers to render react app from the server, and i need to inject the css in the page so i can't use require or fs.readfile at the runtime, since it's not supported in cloudflare. Thank you
Here is how I did it. I built a webpack loader that stores the css output in a variable then i read that variable from the code at the runtime. Here you can find the sourcecode of the loader: https://github.com/bardouni/webpack-inject