Skip to content

Commit

Permalink
Merge pull request #13 from vannyle/additional-updates
Browse files Browse the repository at this point in the history
feat: additional updates
  • Loading branch information
iampearceman authored Oct 30, 2024
2 parents b10cf82 + ab65c39 commit 577abf3
Show file tree
Hide file tree
Showing 10 changed files with 3,409 additions and 321 deletions.
56 changes: 54 additions & 2 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,59 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
// basePath: '/inbox/playground',
// assetPrefix: '/inbox/playground/',
webpack(config) {
const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.(".svg"));

config.module.rules.push(
// Reapply the existing rule, but only for svg imports not ending in ".inline.svg"
{
test: /(?<!inline)\.svg$/,
use: [
{
loader: "url-loader",
options: {
limit: 512,
publicPath: "/_next/static/svgs",
outputPath: "static/svgs",
fallback: "file-loader",
},
},
{
loader: "svgo-loader",
},
],
},
// Convert all other *.svg imports to React components
{
test: /\.inline.svg$/i,
use: [
{
loader: "@svgr/webpack",
options: {
svgo: true,
svgoConfig: {
plugins: [
{
name: "preset-default",
params: {
overrides: {
removeViewBox: false,
},
},
},
"prefixIds",
],
},
},
},
],
},
);

// Modify the file loader rule to ignore *.svg, since we have it handled now.
fileLoaderRule.exclude = /\.svg$/i;

return config;
},
};

export default nextConfig;
Loading

0 comments on commit 577abf3

Please sign in to comment.