Merge branch 'feat/inda-383-daily-stat' into 'main'
[ProtonMail-WebClient.git] / packages / pack / webpack / assets.loader.js
blob92f20b9f0ea748d62ec49f2f6d45faf2b62324bb
1 const DESIGN_SYSTEM_ICONS_SVG = 'sprite-icons.svg|file-icons.svg';
3 module.exports = ({ inlineIcons } = { inlineIcons: false }) => [
5 /**
6 * oneOf allows to take the first match instead of all matches, .e.g
8 * without one of:
10 * sprite-icons.svg -> [svg-inline-loader, url-loader, file-loader]
11 * img-1.svg -> [url loader, file loader]
12 * design-system-icon.svg -> file loader
14 * with one of:
16 * sprite-icons.svg -> svg-inline-loader
17 * img-1.svg -> url loader
18 * design-system-icon.svg -> file loader
20 oneOf: [
22 test: /\.source\.svg/,
23 // Special case for the email sprite icons which is injected into the MessageBodyIframe.tsx from getIframeHtml
24 type: 'asset/source',
25 loader: 'svgo-loader',
26 options: {
27 plugins: ['removeComments'],
31 test: new RegExp(`${DESIGN_SYSTEM_ICONS_SVG}$`),
32 type: inlineIcons ? 'asset/source' : 'asset/resource',
33 loader: 'svgo-loader',
34 options: {
35 plugins: ['removeComments'],
39 test: /\.(bmp|png|jpg|jpeg|gif|svg)$/,
40 type: 'asset/resource',
43 test: /\.(woff|woff2|eot|ttf|otf|mp4|webm|pdf|csv)$/,
44 type: 'asset/resource',
47 test: /\.md$/,
48 type: 'asset/source',