Skip to content

Conversation

@keichinger
Copy link
Contributor

No description provided.

@keichinger keichinger requested a review from apfelbox as a code owner May 24, 2024 06:59
@@ -1,4 +1,4 @@
exports.registerSvgWebpackLoader = (config) =>
export const registerSvgWebpackLoader = (config) =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should write it as TS now, so we don't need any new infrastructure.
Type-wise that might get hard, but using simplified types here is fine.

export const registerSvgWebpackLoader = (config) =>
{
// Grab the existing rule that handles SVG imports
const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.(".svg") && rule.resourceQuery?.toString() !== "/raw/");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember the deal about the /raw/?

// Grab the existing rule that handles SVG imports
const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.(".svg") && rule.resourceQuery?.toString() !== "/raw/");
// Modify the file loader rule to ignore *.svg, since we have it handled now.
fileLoaderRule.exclude = /\.svg$/i;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should

  • add this exclude to every rule, not just the first we find (there might be multiple ones)
  • should merge the exclude with a maybe existing exclude
  • find out why we tested for /raw/ above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants