From 1b3a300173c4531bebf3b88966a1fec64d276440 Mon Sep 17 00:00:00 2001 From: Alberto-Duarte Date: Fri, 21 Apr 2023 13:51:46 +0100 Subject: First commit --- next.config.js | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 next.config.js (limited to 'next.config.js') diff --git a/next.config.js b/next.config.js new file mode 100644 index 0000000..94c7499 --- /dev/null +++ b/next.config.js @@ -0,0 +1,43 @@ +const { hostname } = require('os') + +/** @type {import('next').NextConfig} */ +const nextConfig = { + reactStrictMode: true, + images: { + remotePatterns: [ + { + protocol: 'https', + hostname: 'api.dicebear.com' + } + ] + }, + webpack(config) { + // Grab the existing rule that handles SVG imports + const fileLoaderRule = config.module.rules.find((rule) => + rule.test?.test?.('.svg'), + ) + + config.module.rules.push( + // Reapply the existing rule, but only for svg imports ending in ?url + { + ...fileLoaderRule, + test: /\.svg$/i, + resourceQuery: /url/, // *.svg?url + }, + // Convert all other *.svg imports to React components + { + test: /\.svg$/i, + issuer: /\.[jt]sx?$/, + resourceQuery: { not: /url/ }, // exclude if *.svg?url + use: ['@svgr/webpack'], + }, + ) + + // Modify the file loader rule to ignore *.svg, since we have it handled now. + fileLoaderRule.exclude = /\.svg$/i + + return config + }, +} + +module.exports = nextConfig \ No newline at end of file -- cgit v1.2.3-54-g00ecf