webpack: Disable CompressionPlugin for Puppeteer tests.

Zopfli is very slow and the development server does not use its output
anyway.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-11-06 15:51:03 -08:00 committed by Anders Kaseorg
parent 30c54d023b
commit cd701c8468
2 changed files with 4 additions and 2 deletions

View File

@ -29,6 +29,8 @@ def build_for_prod_or_puppeteer(quiet: bool, config_name: str | None = None) ->
webpack_args += ["--stats=errors-only"] webpack_args += ["--stats=errors-only"]
if config_name is not None: if config_name is not None:
webpack_args += [f"--config-name={config_name}"] webpack_args += [f"--config-name={config_name}"]
if "PUPPETEER_TESTS" in os.environ:
webpack_args.append("--env=puppeteer_tests")
# Silence warnings from "browserslist" about using old data; those # Silence warnings from "browserslist" about using old data; those
# warnings are only useful for development # warnings are only useful for development

View File

@ -17,7 +17,7 @@ import assets from "./webpack.assets.json";
import dev_assets from "./webpack.dev-assets.json"; import dev_assets from "./webpack.dev-assets.json";
const config = ( const config = (
env: {minimize?: boolean; ZULIP_VERSION?: string} = {}, env: {minimize?: true; puppeteer_tests?: true; ZULIP_VERSION?: string} = {},
argv: {mode?: string}, argv: {mode?: string},
): webpack.Configuration[] => { ): webpack.Configuration[] => {
const production: boolean = argv.mode === "production"; const production: boolean = argv.mode === "production";
@ -55,7 +55,7 @@ const config = (
publicPath: production ? "/static/webpack-bundles/" : "/webpack/", publicPath: production ? "/static/webpack-bundles/" : "/webpack/",
}), }),
]; ];
if (production) { if (production && !env.puppeteer_tests) {
plugins.push( plugins.push(
new CompressionPlugin<ZopfliOptions>({ new CompressionPlugin<ZopfliOptions>({
// Use zopfli to write pre-compressed versions of text files // Use zopfli to write pre-compressed versions of text files