From 22b231fcbb98ff71a2cf3755e2779280c1e47028 Mon Sep 17 00:00:00 2001 From: William Durand Date: Fri, 8 Oct 2021 10:07:15 +0200 Subject: [PATCH] Do not copy QRCode images when building blog-utils lib (#10956) --- webpack-common.js | 38 ++++++++++++++++++------------ webpack.blog-utils.config.babel.js | 2 +- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/webpack-common.js b/webpack-common.js index 4a20e6105c6..dff9fd54fd3 100644 --- a/webpack-common.js +++ b/webpack-common.js @@ -120,7 +120,10 @@ export function getRules({ ]; } -export function getPlugins({ withBrowserWindow = true } = {}) { +export function getPlugins({ + withBrowserWindow = true, + withQRCodes = true, +} = {}) { const clientConfig = getClientConfig(config); const plugins = [ @@ -146,22 +149,27 @@ export function getPlugins({ withBrowserWindow = true } = {}) { /locale$/, new RegExp(`^\\.\\/.*?\\/amo\\.js$`), ), - new CopyPlugin({ - patterns: [ - { - from: path.resolve( - __dirname, - 'src', - 'amo', - 'components', - 'AddonQRCode', - 'img', - ), - }, - ], - }), ]; + if (withQRCodes) { + plugins.push( + new CopyPlugin({ + patterns: [ + { + from: path.resolve( + __dirname, + 'src', + 'amo', + 'components', + 'AddonQRCode', + 'img', + ), + }, + ], + }), + ); + } + if (withBrowserWindow) { plugins.push( // This swaps the server side window object with a standard browser diff --git a/webpack.blog-utils.config.babel.js b/webpack.blog-utils.config.babel.js index 251dbb2bce2..a4bc54caf4c 100644 --- a/webpack.blog-utils.config.babel.js +++ b/webpack.blog-utils.config.babel.js @@ -30,7 +30,7 @@ const makeConfig = ({ target, externals = {} }) => ({ rules: getRules({ fileLimit: 20000 }), }, plugins: [ - ...getPlugins({ withBrowserWindow: target === 'web' }), + ...getPlugins({ withBrowserWindow: target === 'web', withQRCodes: false }), new webpack.NormalModuleReplacementPlugin( /amo\/tracking/, 'blog-utils/tracking.js',