Skip to content

Commit 22b231f

Browse files
authored
Do not copy QRCode images when building blog-utils lib (#10956)
1 parent 896a3b1 commit 22b231f

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

webpack-common.js

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ export function getRules({
120120
];
121121
}
122122

123-
export function getPlugins({ withBrowserWindow = true } = {}) {
123+
export function getPlugins({
124+
withBrowserWindow = true,
125+
withQRCodes = true,
126+
} = {}) {
124127
const clientConfig = getClientConfig(config);
125128

126129
const plugins = [
@@ -146,22 +149,27 @@ export function getPlugins({ withBrowserWindow = true } = {}) {
146149
/locale$/,
147150
new RegExp(`^\\.\\/.*?\\/amo\\.js$`),
148151
),
149-
new CopyPlugin({
150-
patterns: [
151-
{
152-
from: path.resolve(
153-
__dirname,
154-
'src',
155-
'amo',
156-
'components',
157-
'AddonQRCode',
158-
'img',
159-
),
160-
},
161-
],
162-
}),
163152
];
164153

154+
if (withQRCodes) {
155+
plugins.push(
156+
new CopyPlugin({
157+
patterns: [
158+
{
159+
from: path.resolve(
160+
__dirname,
161+
'src',
162+
'amo',
163+
'components',
164+
'AddonQRCode',
165+
'img',
166+
),
167+
},
168+
],
169+
}),
170+
);
171+
}
172+
165173
if (withBrowserWindow) {
166174
plugins.push(
167175
// This swaps the server side window object with a standard browser

webpack.blog-utils.config.babel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const makeConfig = ({ target, externals = {} }) => ({
3030
rules: getRules({ fileLimit: 20000 }),
3131
},
3232
plugins: [
33-
...getPlugins({ withBrowserWindow: target === 'web' }),
33+
...getPlugins({ withBrowserWindow: target === 'web', withQRCodes: false }),
3434
new webpack.NormalModuleReplacementPlugin(
3535
/amo\/tracking/,
3636
'blog-utils/tracking.js',

0 commit comments

Comments
 (0)