Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

chore: cleanup next.config file

Marc Seitz3a39fc494188
diff --git a/next.config.mjs b/next.config.mjs
index 68c155ee..1688d527 100644
--- a/next.config.mjs
+++ b/next.config.mjs
@@ -4,69 +4,7 @@ const nextConfig = {
pageExtensions: ["js", "jsx", "ts", "tsx", "mdx"],
images: {
minimumCacheTTL: 2592000, // 30 days
- remotePatterns: [
- {
- // static images and videos
- protocol: "https",
- hostname: "assets.papermark.io",
- },
- {
- // user-shared documents and files
- protocol: "https",
- hostname: process.env.NEXT_PRIVATE_UPLOAD_DISTRIBUTION_HOST ?? "",
- },
- {
- // twitter img
- protocol: "https",
- hostname: "pbs.twimg.com",
- },
- {
- // linkedin img
- protocol: "https",
- hostname: "media.licdn.com",
- },
- {
- // google img
- protocol: "https",
- hostname: "lh3.googleusercontent.com",
- },
- {
- // local img
- protocol: "http",
- hostname: "localhost",
- port: "3000",
- },
- {
- // papermark img
- protocol: "https",
- hostname: "www.papermark.io",
- },
- {
- // special document pages
- protocol: "https",
- hostname: "d36r2enbzam0iu.cloudfront.net",
- },
- {
- // staging vercel blob
- protocol: "https",
- hostname: "36so9a8uzykxknsu.public.blob.vercel-storage.com",
- },
- {
- // production vercel blob
- protocol: "https",
- hostname: "yoywvlh29jppecbh.public.blob.vercel-storage.com",
- },
- {
- // blog images
- protocol: "https",
- hostname: "aicontentfy-customer-images.s3.eu-central-1.amazonaws.com",
- },
- {
- // also blog images
- protocol: "https",
- hostname: "dev-to-uploads.s3.amazonaws.com",
- },
- ],
+ remotePatterns: prepareRemotePatterns(),
},
transpilePackages: ["@trigger.dev/react"],
skipTrailingSlashRedirect: true,
@@ -78,4 +16,56 @@ const nextConfig = {
},
};
+function prepareRemotePatterns() {
+ let patterns = [
+ // static images and videos
+ { protocol: "https", hostname: "assets.papermark.io" },
+ // twitter img
+ { protocol: "https", hostname: "pbs.twimg.com" },
+ // linkedin img
+ { protocol: "https", hostname: "media.licdn.com" },
+ // google img
+ { protocol: "https", hostname: "lh3.googleusercontent.com" },
+ // papermark img
+ { protocol: "https", hostname: "www.papermark.io" },
+ // special document pages
+ { protocol: "https", hostname: "d36r2enbzam0iu.cloudfront.net" },
+ // blog images
+ {
+ protocol: "https",
+ hostname: "aicontentfy-customer-images.s3.eu-central-1.amazonaws.com",
+ },
+ // also blog images
+ { protocol: "https", hostname: "dev-to-uploads.s3.amazonaws.com" },
+ ];
+
+ if (process.env.NEXT_PRIVATE_UPLOAD_DISTRIBUTION_HOST) {
+ patterns.push({
+ protocol: "https",
+ hostname: process.env.NEXT_PRIVATE_UPLOAD_DISTRIBUTION_HOST,
+ });
+ }
+
+ if (process.env.VERCEL_ENV === "production") {
+ patterns.push({
+ // production vercel blob
+ protocol: "https",
+ hostname: "yoywvlh29jppecbh.public.blob.vercel-storage.com",
+ });
+ }
+
+ if (
+ process.env.VERCEL_ENV === "preview" ||
+ process.env.NODE_ENV === "development"
+ ) {
+ patterns.push({
+ // staging vercel blob
+ protocol: "https",
+ hostname: "36so9a8uzykxknsu.public.blob.vercel-storage.com",
+ });
+ }
+
+ return patterns;
+}
+
export default nextConfig;