aboutsummaryrefslogtreecommitdiffstats
path: root/next.config.js
diff options
context:
space:
mode:
authorAlberto-Duarte <alberto@albertoduarte.com>2023-04-21 13:51:46 +0100
committerAlberto-Duarte <alberto@albertoduarte.com>2023-04-21 13:51:46 +0100
commit1b3a300173c4531bebf3b88966a1fec64d276440 (patch)
tree6c8f9f0a745eadd3615a50bbf47e14d1233cb80c /next.config.js
First commit
Diffstat (limited to 'next.config.js')
-rw-r--r--next.config.js43
1 files changed, 43 insertions, 0 deletions
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