How to use mini-css-extract-plugin / ExposeRuntimeCssAssetsPlugin only during production? #13
-
The recommend way of working with the mini-css-extract-plugin, is to not use it in development builds. However doing so, breaks the "webpackExtractedCss" option of single-spa-css. Is there a better solution for this possible then making the value of that option depended on which kind of build you're doing? |
Beta Was this translation helpful? Give feedback.
Replies: 0 comments 1 reply
-
This discussion seems more related to single-spa-css than to create-single-spa, since create-single-spa doesn't use single-spa-css yet (although I'd like it to be added). I'm transferring this to the single-spa-css repo. Generally I prefer keeping functionality the same for development vs production where possible. So when I use single-spa-css I just use it for both development and production. This is for two reasons:
However, if you wish to do so anyway, the normal way to solve for this is to use webpack's DefinePlugin or dotenv-webpack to replace const cssLifecycles = singleSpaCss({
webpackExtractedCss: process.env.NODE_ENV === 'production'
});``` |
Beta Was this translation helpful? Give feedback.
This discussion seems more related to single-spa-css than to create-single-spa, since create-single-spa doesn't use single-spa-css yet (although I'd like it to be added). I'm transferring this to the single-spa-css repo.
Generally I prefer keeping functionality the same for development vs production where possible. So when I use single-spa-css I just use it for both development and production. This is for two reasons: