@@ -55,6 +55,8 @@ export function getStyleLoaders(
5555 ...cssOptionsArg ,
5656 } ;
5757
58+ // On the server we don't really need to extract/emit CSS
59+ // We only need to transform CSS module imports to a styles object
5860 if ( isServer ) {
5961 return cssOptions . modules
6062 ? [
@@ -63,20 +65,8 @@ export function getStyleLoaders(
6365 options : cssOptions ,
6466 } ,
6567 ]
66- : [
67- {
68- loader : MiniCssExtractPlugin . loader ,
69- options : {
70- // Don't emit CSS files for SSR (previously used null-loader)
71- // See https://github.com/webpack-contrib/mini-css-extract-plugin/issues/90#issuecomment-811991738
72- emit : false ,
73- } ,
74- } ,
75- {
76- loader : require . resolve ( 'css-loader' ) ,
77- options : cssOptions ,
78- } ,
79- ] ;
68+ : // Ignore regular CSS files
69+ [ { loader : require . resolve ( 'null-loader' ) } ] ;
8070 }
8171
8272 return [
@@ -90,6 +80,12 @@ export function getStyleLoaders(
9080 loader : require . resolve ( 'css-loader' ) ,
9181 options : cssOptions ,
9282 } ,
83+
84+ // TODO apart for configurePostCss(), do we really need this loader?
85+ // Note: using postcss here looks inefficient/duplicate
86+ // But in practice, it's not a big deal because css-loader also uses postcss
87+ // and is able to reuse the parsed AST from postcss-loader
88+ // See https://github.com/webpack-contrib/css-loader/blob/master/src/index.js#L159
9389 {
9490 // Options for PostCSS as we reference these options twice
9591 // Adds vendor prefixing based on your specified browser support in
0 commit comments