Skip to content

Commit

Permalink
Do not copy QRCode images when building blog-utils lib (#10956)
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand authored Oct 8, 2021
1 parent 896a3b1 commit 22b231f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
38 changes: 23 additions & 15 deletions webpack-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion webpack.blog-utils.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 22b231f

Please sign in to comment.