]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10672 Avoid async css chunks (#294)
authorStas Vilchik <stas.vilchik@sonarsource.com>
Wed, 30 May 2018 12:10:36 +0000 (14:10 +0200)
committerSonarTech <sonartech@sonarsource.com>
Wed, 30 May 2018 18:20:47 +0000 (20:20 +0200)
server/sonar-web/config/webpack.config.js

index 30cccdbd7aeed14a366839a92505751e27bb27be..5e89c7f0e2f2374a0b4c7fe1144a793637d34696 100644 (file)
@@ -67,12 +67,20 @@ module.exports = ({ production = true }) => ({
         ]
       },
       {
+        // extract styles from 'app/' into separate file
         test: /\.css$/,
+        include: path.resolve(__dirname, '../src/main/js/app/styles'),
         use: [
           production ? MiniCssExtractPlugin.loader : 'style-loader',
           utils.cssLoader({ production }),
           utils.postcssLoader()
-        ].filter(Boolean)
+        ]
+      },
+      {
+        // inline all other styles
+        test: /\.css$/,
+        exclude: path.resolve(__dirname, '../src/main/js/app/styles'),
+        use: ['style-loader', utils.cssLoader({ production }), utils.postcssLoader()]
       },
       {
         test: /\.md$/,
@@ -84,7 +92,7 @@ module.exports = ({ production = true }) => ({
         test: /\.directory-loader\.js$/,
         loader: path.resolve(__dirname, 'documentation-loader/index.js')
       }
-    ].filter(Boolean)
+    ]
   },
   plugins: [
     // `allowExternal: true` to remove files outside of the current dir
@@ -139,7 +147,7 @@ module.exports = ({ production = true }) => ({
   performance: production
     ? {
         hints: 'error',
-        maxEntrypointSize: 700000, // ~700kb, recommended: 250kb
+        maxEntrypointSize: 710000, // ~700kb, recommended: 250kb
         maxAssetSize: 400000 // ~400kb, recommended: 250kb
       }
     : undefined