From d838a5c6d7ddf0b0e2b449882dfddbabe8181ab3 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 30 May 2018 14:10:36 +0200 Subject: [PATCH] SONAR-10672 Avoid async css chunks (#294) --- server/sonar-web/config/webpack.config.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/server/sonar-web/config/webpack.config.js b/server/sonar-web/config/webpack.config.js index 30cccdbd7ae..5e89c7f0e2f 100644 --- a/server/sonar-web/config/webpack.config.js +++ b/server/sonar-web/config/webpack.config.js @@ -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 -- 2.39.5