-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add common Webpack Build Config for NextJS projects and Storybook for a shared SVGR integration. #37
base: 2.x
Are you sure you want to change the base?
Conversation
@@ -1,4 +1,4 @@ | |||
exports.registerSvgWebpackLoader = (config) => | |||
export const registerSvgWebpackLoader = (config) => |
There was a problem hiding this comment.
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/"); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 existingexclude
- find out why we tested for
/raw/
above
No description provided.