jaredpalmer / razzle

✨ Create server-rendered universal JavaScript applications with no configuration
https://razzlejs.org
MIT License
11.1k stars 868 forks source link

Make usage of `mini-css-extract-plugin` optional #1594

Open dios-david opened 3 years ago

dios-david commented 3 years ago

🚀 Feature request

Current Behavior

I have to install mini-css-extract-plugin in order to make Razzle 4 work.

Desired Behavior

Razzle 4 is usable without mini-css-extract-plugin if the project doesn't need that.

Suggested Solution

a) Make createConfigAsync.js to load this plugin only when it's actually used b) Add a config option to disable css/style handling in default config (and leave it turned on by default for backward compatibility)

Who does this impact? Who is this for?

Projects without css (e.g. using a css-in-js solution).

Describe alternatives you've considered

Haven't tried this, but probably I could create a local mini-css-extract-plugin dummy project and point mini-css-extract-plugin to that folder with file:... in my package.json.

I can also install this package, but technically I don't need that, so... that's why I thought I should point this out.

fivethreeo commented 3 years ago

Ideally every part of razzle should be a plugin. Then have a default set of core plugins.

ceopaludetto commented 3 years ago

I think when buildType is set to serveronly or serverless, mini-css-extract-plugin, postcss and html-webpack-plugin should be disabled by default, we can check if package is actually installed and only add in the chain if they're installed