From f8df855e4b18531faad30ed36b422cae45c21519 Mon Sep 17 00:00:00 2001 From: Tyler Rockwood Date: Fri, 7 Jan 2022 15:18:20 -0600 Subject: [PATCH] Allow for async minifiers Terser v5 is async, so if we want to upgrade to support the latest syntax we need this. --- packages/metro-transform-worker/src/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/metro-transform-worker/src/index.js b/packages/metro-transform-worker/src/index.js index 7977ca5a4f..329952719a 100644 --- a/packages/metro-transform-worker/src/index.js +++ b/packages/metro-transform-worker/src/index.js @@ -72,7 +72,9 @@ export type MinifierResult = { ... }; -export type Minifier = MinifierOptions => MinifierResult; +export type Minifier = MinifierOptions => + | MinifierResult + | Promise; export type Type = 'script' | 'module' | 'asset'; @@ -218,7 +220,7 @@ const minifyCode = async ( const minify = getMinifier(config.minifierPath); try { - const minified = minify({ + const minified = await minify({ code, map: sourceMap, filename,